coxlab / tsnet

Tensor Switching Networks
12 stars 9 forks source link

Type Error #2

Closed HunterHantao closed 7 years ago

HunterHantao commented 7 years ago

I try to run this code with command as below python2.7 tsnet_cli.py -d mnist -n conv:0/16 relu:0 flat:0 sfmx:0/10 -e 10 -lrnparam 1e-3 1e-3 0.9 -v 1

Please suggest me how to fix it. Thanks a lot.

Traceback (most recent call last): File "tsnet_cli.py", line 4, in run(sys.argv[1:]) File "/home/kowalski/tensor/tsnet/tsnet/launcher.py", line 38, in run hst = net.fit(dataset, settings) File "/home/kowalski/tensor/tsnet/tsnet/core_numpy/network.py", line 218, in fit ly = th-4; trn += [process(XT, YT )]; self.solve() File "/home/kowalski/tensor/tsnet/tsnet/core_numpy/network.py", line 195, in process rep = self.backward(Yb).update(settings.lrnalg, settings.lrnparam) if trn else None File "/home/kowalski/tensor/tsnet/tsnet/core_numpy/network.py", line 100, in backward for B in self.blocks[::-1]: Y = B.backward(Y) File "/home/kowalski/tensor/tsnet/tsnet/core_numpy/network.py", line 43, in backward for L in self.layers[::-1]: Y = L.backward(Y, mode='XG') if Y is not None else Y File "/home/kowalski/tensor/tsnet/tsnet/core_numpy/layers.py", line 156, in backward O = unexpand(O) File "/home/kowalski/tensor/tsnet/tsnet/core_numpy/layers.py", line 73, in unexpand for y, x in product(xrange(T.shape[4]), xrange(T.shape[5])): neadd(O[:,:,y:y+T.shape[2],x:x+T.shape[3]], T[:,:,:,:,y,x]) File "/home/kowalski/tensor/tsnet/tsnet/core_numpy/layers.py", line 12, in neadd def neadd(Y, X): ne.evaluate('Y + X', out=Y) File "/usr/local/lib/python2.7/dist-packages/numexpr/necompiler.py", line 802, in evaluate return compiled_ex(*arguments, **kwargs) TypeError: Iterator requested dtype could not be cast from dtype('float64') to dtype('float32'), the operand 0 dtype, according to the rule 'safe'

HunterHantao commented 7 years ago

Closed. After I revise all the float32 to float64

cytsai commented 7 years ago

Hi, thanks for your interest in our project, and I'm glad you've found a solution.

For speed considerations, I would however recommend setting floatx in keras.json or .theanorc to float32 instead. Hope this helps.