jbornschein / draw

Reimplementation of DRAW
MIT License
347 stars 84 forks source link

Compilation is failing on cuda #27

Closed faizan94 closed 8 years ago

faizan94 commented 8 years ago

ValueError Traceback (most recent call last) /home/val/Desktop/draw/train-draw.py in () 275 args = parser.parse_args() 276 --> 277 main(**vars(args))

/home/val/Desktop/draw/train-draw.py in main(name, dataset, epochs, batch_size, learning_rate, attention, n_iter, enc_dim, dec_dim, z_dim, oldmodel) 158 x = tensor.matrix('features') 159 --> 160 x_recons, kl_terms = draw.reconstruct(x) 161 162 recons_term = BinaryCrossEntropy().apply(x, x_recons)

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in call(self, _args, _kwargs) 358 359 def call(self, _args, _kwargs): --> 360 return self.application.apply(self, _args, *_kwargs) 361 362

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in apply(self, bound_application, _args, _kwargs) 300 self.call_stack.append(brick) 301 try: --> 302 outputs = self.application_function(brick, _args, _kwargs) 303 outputs = pack(outputs) 304 finally:

/home/val/Desktop/draw/draw/draw.pyc in reconstruct(self, features) 341 342 c, h_enc, c_enc, z, kl, h_dec, c_dec = \ --> 343 rvals = self.apply(x=features, u=u) 344 345 x_recons = T.nnet.sigmoid(c[-1,:,:])

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in call(self, _args, _kwargs) 358 359 def call(self, _args, _kwargs): --> 360 return self.application.apply(self, _args, *_kwargs) 361 362

/usr/local/lib/python2.7/dist-packages/blocks/bricks/base.pyc in apply(self, bound_application, _args, _kwargs) 300 self.call_stack.append(brick) 301 try: --> 302 outputs = self.application_function(brick, _args, _kwargs) 303 outputs = pack(outputs) 304 finally:

/usr/local/lib/python2.7/dist-packages/blocks/bricks/recurrent.pyc in recurrent_apply(brick, application, application_call, _args, *_kwargs) 231 gobackwards=reverse, 232 name='{}{}_scan'.format( --> 233 brick.name, application.application_name)) 234 result = pack(result) 235 if return_initial_states:

/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan.pyc in scan(fn, sequences, outputs_info, non_sequences, n_steps, truncate_gradient, go_backwards, mode, name, profile, allow_gc, strict) 1042 pass 1043 scan_inputs += [arg] -> 1044 scan_outs = local_op(*scan_inputs) 1045 if type(scan_outs) not in (list, tuple): 1046 scan_outs = [scan_outs]

/usr/local/lib/python2.7/dist-packages/theano/gof/op.pyc in call(self, _inputs, _kwargs) 598 """ 599 return_list = kwargs.pop('return_list', False) --> 600 node = self.make_node(_inputs, _kwargs) 601 602 if config.compute_test_value != 'off':

/usr/local/lib/python2.7/dist-packages/theano/scan_module/scan_op.pyc in make_node(self, *inputs) 539 argoffset + idx, 540 outer_sitsot.type.dtype, --> 541 inner_sitsot_out.type.dtype)) 542 if inner_sitsot_out.ndim != outer_sitsot.ndim - 1: 543 raise ValueError(err_msg3 %

ValueError: When compiling the inner function of scan the following error has been encountered: The initial state (outputs_info in scan nomenclature) of variable IncSubtensor{Set;:int64:}.0 (argument number 1) has dtype float32, while the result of the inner function (fn) has dtype float64. This can happen if the inner function of scan results in an upcast or downcast.

jbornschein commented 8 years ago

This commit should fix it: 6bb2718a27aae181469eda7ae7a070792bb77eb7

I did not trace it back to a specific change in blocks or theano, but I had the same problem today.

I'll merge it ASAP.

faizan94 commented 8 years ago

I tried the code with no attention parameter and it works. I dont know where it is upcasting or downcasting. Hope to get the answer soon.

jbornschein commented 8 years ago

PR #30 should have fixed it. Can you please update and try again?