Soonhwan-Kwon / capsnet.mxnet

MXNet implementation of CapsNet
29 stars 13 forks source link

c_array_buf(mx_uint, array('I', sdata)), TypeError: array item must be integer #13

Open machuck opened 6 years ago

machuck commented 6 years ago
$ python3.6 capsulenet.py --batch_size 90 --devices cpu0,cpu1,cpu2,cpu3,cpu4,cpu5,cpu6,cpu7,cpu8 --num_epoch 100 --lr .001 --num_routing 3 --decay .99 --model_prefix lr_0_0005_decay_0_99
capsulenet.py:108: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
  label = np.fromstring(flbl.read(), dtype=np.int8)
capsulenet.py:111: DeprecationWarning: The binary mode of fromstring is deprecated, as it behaves surprisingly on unicode inputs. Use frombuffer instead
  image = np.fromstring(fimg.read(), dtype=np.uint8).reshape(len(label), rows, cols)
batch_size: 90
decay: 0.99
devices: cpu0,cpu1,cpu2,cpu3,cpu4,cpu5,cpu6,cpu7,cpu8
lr: 0.001
model_prefix: lr_0_0005_decay_0_99
num_epoch: 100
num_routing: 3
recon_loss_weight: 0.392
tblog_dir: tblog
==================== NUMBER OF GPU:  9

Traceback (most recent call last):
  File "capsulenet.py", line 339, in <module>
    final_net = capsnet(batch_size=args.batch_size/num_gpu, n_class=10, num_routing=args.num_routing, recon_loss_weight=args.recon_loss_weight)
  File "capsulenet.py", line 56, in capsnet
    primarycaps.infer_shape(data=(batch_size, 1, 28, 28))
  File "/usr/local/lib/python3.6/site-packages/mxnet-1.0.0-py3.6.egg/mxnet/symbol/symbol.py", line 965, in infer_shape
    res = self._infer_shape_impl(False, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/mxnet-1.0.0-py3.6.egg/mxnet/symbol/symbol.py", line 1085, in _infer_shape_impl
    c_array_buf(mx_uint, array('I', sdata)),
TypeError: array item must be integer
machuck commented 6 years ago

Fixed by function int(...) Sorry shouldn't have posted before looking into it.