Skip to content

Commit

Permalink
Check for dimension mismatch in param.
Browse files Browse the repository at this point in the history
  • Loading branch information
null-a committed Feb 24, 2017
1 parent 713004c commit 6133cd5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/params/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ module.exports = function(env) {
function finish(s) {
var val = params.fetch(name, env);
var valDims = ad.value(val).dims;
if (!_.isEqual(dims, valDims)) {
var msg = 'The dims specified here (' + JSON.stringify(dims) +
') do not match the dims of the current value (' +
JSON.stringify(valDims) + '). The current value may ' +
'come from an earlier call to param, or from a previous ' +
'execution when a persistent parameter store is used.';
throw new Error(msg);
}
return k(s, dims === dimsForScalarParam ? ad.tensor.get(val, 0) : val);
};
};
Expand Down

0 comments on commit 6133cd5

Please sign in to comment.