keras-surgeon
keras-surgeon copied to clipboard
TypeError: 'NoneType' object cannot be interpreted as an integer
Hello, when I used the delete_channels function to delete specific channels ,the following error occurred. model = delete_channels(model,final_prune_target[0][1],final_prune_target[0][2])
the final_prune_target: [['block3_conv1', <keras.layers.convolutional.Conv2D object at 0x7fd0da4389b0>, [137]],
File "/usr/local/lib/python3.5/dist-packages/kerassurgeon/operations.py", line 105, in delete_channels return surgeon.operate() File "/usr/local/lib/python3.5/dist-packages/kerassurgeon/surgeon.py", line 158, in operate self._mod_func_map[node](node, outputs, output_masks, **kwargs) File "/usr/local/lib/python3.5/dist-packages/kerassurgeon/surgeon.py", line 309, in _delete_channels new_delete_mask = self._make_delete_mask(old_layer, channels) File "/usr/local/lib/python3.5/dist-packages/kerassurgeon/surgeon.py", line 668, in _make_delete_mask new_delete_mask = np.ones(layer.output_shape[1:], dtype=bool) File "/usr/local/lib/python3.5/dist-packages/numpy/core/numeric.py", line 203, in ones a = empty(shape, dtype, order) TypeError: 'NoneType' object cannot be interpreted as an integer Any advice?Thanks a lot.
@SherlockHua1995 Have you solved the error? If you solved, Could you tell that how did you figure out? I also got this type of error. Thanks....
hello,I have fixed this error for a long time so that I can't remember the details. I followed the error construction and check the functions called step after step. Good luck.
Can anyone help me out I am having the same issue
@KathySwe @SherlockHua1995
@Sushant-aggarwal Hi, I have met such issue and solved it. My case is that the model is dynamic input size, so make sure your model input size is fixed. Hope this will help.