Multi-level-DCNet icon indicating copy to clipboard operation
Multi-level-DCNet copied to clipboard

ValueError: Shapes must be equal rank, but are 1 and 2 for 'digitcaps0/map/while/MatMul' (op: 'BatchMatMul') with input shapes: [10,2700,8], [10,2700,16,8].

Open asifraza151 opened this issue 6 years ago • 2 comments

asifraza151 avatar May 11 '19 07:05 asifraza151

Multi-level-DCNet-master$ python3 3leveldcnet.py Using TensorFlow backend. 2019-05-11 15:15:51.395251: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2019-05-11 15:15:51.503811: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero 2019-05-11 15:15:51.504196: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties: name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.6325 pciBusID: 0000:01:00.0 totalMemory: 10.91GiB freeMemory: 10.45GiB 2019-05-11 15:15:51.504210: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0 2019-05-11 15:15:51.689427: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix: 2019-05-11 15:15:51.689477: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0 2019-05-11 15:15:51.689484: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N 2019-05-11 15:15:51.689643: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10104 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1) Namespace(batch_size=64, debug=False, digit=5, epochs=500, lam_recon=0.512, lr=0.001, lr_decay=0.9, routings=3, save_dir='./result', shift_fraction=0.1, testing=False, weights=None) WARNING:tensorflow:From /home/asif/anaconda3/envs/asifraza/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py:1044: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead /home/asif/anaconda3/envs/asifraza/lib/python3.5/site-packages/keras/legacy/layers.py:429: UserWarning: The merge function is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. sum, concatenate, etc. warnings.warn('The merge function is deprecated ' /home/asif/anaconda3/envs/asifraza/lib/python3.5/site-packages/keras/legacy/layers.py:66: UserWarning: The Merge layer is deprecated and will be removed after 08/2017. Use instead layers from keras.layers.merge, e.g. add, concatenate, etc. warnings.warn('The Merge layer is deprecated ' Traceback (most recent call last): File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1628, in _create_c_op c_op = c_api.TF_FinishOperation(op_desc) tensorflow.python.framework.errors_impl.InvalidArgumentError: Shapes must be equal rank, but are 1 and 2 for 'digitcaps0/map/while/MatMul' (op: 'BatchMatMul') with input shapes: [10,2700,8], [10,2700,16,8].

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "3leveldcnet.py", line 338, in routings=args.routings) File "3leveldcnet.py", line 96, in MultiLevelDCNet name='digitcaps0')(mergedLayer) File "/home/asif/anaconda3/envs/asifraza/lib/python3.5/site-packages/keras/engine/topology.py", line 545, in call output = self.call(inputs, **kwargs) File "/media/asif/E6FE3847FE381273/Users/ASIF RAZA/Desktop/study pp/fourth week/Multi-level-DCNet-master/capsulelayers.py", line 130, in call inputs_hat = K.map_fn(lambda x: K.batch_dot(x, self.W, [2, 3]), elems=inputs_tiled) File "/home/asif/anaconda3/envs/asifraza/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 3330, in map_fn return tf.map_fn(fn, elems, name=name) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/functional_ops.py", line 494, in map_fn maximum_iterations=n) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3291, in while_loop return_same_structure) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3004, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2939, in _BuildLoop body_result = body(*packed_vars_for_body) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/control_flow_ops.py", line 3260, in body = lambda i, lv: (i + 1, orig_body(*lv)) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/functional_ops.py", line 483, in compute packed_fn_values = fn(packed_values) File "/media/asif/E6FE3847FE381273/Users/ASIF RAZA/Desktop/study pp/fourth week/Multi-level-DCNet-master/capsulelayers.py", line 130, in inputs_hat = K.map_fn(lambda x: K.batch_dot(x, self.W, [2, 3]), elems=inputs_tiled) File "/home/asif/anaconda3/envs/asifraza/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 915, in batch_dot out = tf.matmul(x, y, adjoint_a=adj_x, adjoint_b=adj_y) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/math_ops.py", line 2019, in matmul a, b, adj_x=adjoint_a, adj_y=adjoint_b, name=name) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/ops/gen_math_ops.py", line 1245, in batch_mat_mul "BatchMatMul", x=x, y=y, adj_x=adj_x, adj_y=adj_y, name=name) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func return func(*args, **kwargs) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op op_def=op_def) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1792, in init control_input_ops) File "/home/asif/.local/lib/python3.5/site-packages/tensorflow/python/framework/ops.py", line 1631, in _create_c_op raise ValueError(str(e)) ValueError: Shapes must be equal rank, but are 1 and 2 for 'digitcaps0/map/while/MatMul' (op: 'BatchMatMul') with input shapes: [10,2700,8], [10,2700,16,8].

why the error

asifraza151 avatar May 11 '19 07:05 asifraza151

I am getting the same error. Have you figured out the solution?

shrybht avatar May 16 '19 10:05 shrybht