Open soswow opened 5 years ago
My current workaround is to do this:
deepqlearn.Brain.prototype.policy = function(s) {
const svol_sx = this.value_net.layers[0].out_sx;
const svol_sy = this.value_net.layers[0].out_sy;
const svol_depth = this.value_net.layers[0].out_depth;
var svol = new convnetjs.Vol(svol_sx, svol_sy, svol_depth);
svol.w = s;
var action_values = this.value_net.forward(svol);
var maxk = 0;
var maxval = action_values.w[0];
for(var k=1;k<this.num_actions;k++) {
if(action_values.w[k] > maxval) { maxk = k; maxval = action_values.w[k]; }
}
return {action:maxk, value:maxval};
};```
There is a problem with this line: https://github.com/karpathy/convnetjs/blob/4c3358a315b4d71f31a0d532eb5d1700e9e592ee/build/deepqlearn.js#L142
the shape of the input vector is basically hardcoded here when given to the network's forward function. Which makes it all break apart in line https://github.com/karpathy/convnetjs/blob/4c3358a315b4d71f31a0d532eb5d1700e9e592ee/src/convnet_layers_dotproducts.js#L67 Where we try to check for existence of those dimensions.