When I run QuickStarts/STMeta.py with the st_method='GRU', gclstm_layers=2, I encountered the following error.
How should I fix it?
The key error message is as follows:
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 1 and 64 for 'rnn/MatMul' (op: 'MatMul') with input shapes: [?,1], [64,64].
File "/home/zhuhang/Work/UCTB/QuickStarts/STMeta.py", line 24, in <module>
STMeta_Obj.build()
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/UCTB/model/STMeta.py", line 192, in build
tf.reshape(target_tensor, [-1, time_step, 1]))
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 701, in __call__
return super(RNN, self).__call__(inputs, **kwargs)
The complete error message is as follows:
Traceback (most recent call last):
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1659, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 1 and 64 for 'rnn/MatMul' (op: 'MatMul') with input shapes: [?,1], [64,64].
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/zhuhang/.vscode-server/extensions/ms-python.python-2022.6.3/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
cli.main()
File "/home/zhuhang/.vscode-server/extensions/ms-python.python-2022.6.3/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 444, in main
run()
File "/home/zhuhang/.vscode-server/extensions/ms-python.python-2022.6.3/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/zhuhang/Work/UCTB/QuickStarts/STMeta.py", line 24, in <module>
STMeta_Obj.build()
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/UCTB/model/STMeta.py", line 192, in build
tf.reshape(target_tensor, [-1, time_step, 1]))
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 701, in __call__
return super(RNN, self).__call__(inputs, **kwargs)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 554, in __call__
outputs = self.call(inputs, *args, **kwargs)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 822, in call
zero_output_for_mask=self.zero_output_for_mask)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3453, in rnn
initial_states + constants)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 807, in step
output, new_states = self.cell.call(inputs, states, **kwargs)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 137, in call
inputs, states = cell.call(inputs, states, **kwargs)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/layers/recurrent.py", line 1544, in call
x_z = K.dot(inputs_z, self.kernel[:, :self.units])
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 1463, in dot
out = math_ops.matmul(x, y)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py", line 2455, in matmul
a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5333, in mat_mul
name=name)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3300, in create_op
op_def=op_def)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1823, in __init__
control_input_ops)
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1662, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 1 and 64 for 'rnn/MatMul' (op: 'MatMul') with input shapes: [?,1], [64,64].
ERROR:tensorflow:==================================
Object was never used (type <class 'tensorflow.python.ops.tensor_array_ops.TensorArray'>):
<tensorflow.python.ops.tensor_array_ops.TensorArray object at 0x7fe56dbfdf28>
If you want to mark it as used call its "mark_used()" method.
It was originally created here:
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3443, in <genexpr>
for ta, input_ in zip(input_ta, flatted_inputs)) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 193, in wrapped
return _add_should_use_warning(fn(*args, **kwargs))
==================================
ERROR:tensorflow:==================================
Object was never used (type <class 'tensorflow.python.ops.tensor_array_ops.TensorArray'>):
<tensorflow.python.ops.tensor_array_ops.TensorArray object at 0x7fe56dbfdcf8>
If you want to mark it as used call its "mark_used()" method.
It was originally created here:
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3443, in <genexpr>
for ta, input_ in zip(input_ta, flatted_inputs)) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 193, in wrapped
return _add_should_use_warning(fn(*args, **kwargs)) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 1179, in unstack
return self._implementation.unstack(value, name=name) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 193, in wrapped
return _add_should_use_warning(fn(*args, **kwargs))
==================================
ERROR:tensorflow:==================================
Object was never used (type <class 'tensorflow.python.ops.tensor_array_ops.TensorArray'>):
<tensorflow.python.ops.tensor_array_ops.TensorArray object at 0x7fe56dbfdd68>
If you want to mark it as used call its "mark_used()" method.
It was originally created here:
File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 3443, in <genexpr>
for ta, input_ in zip(input_ta, flatted_inputs)) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 193, in wrapped
return _add_should_use_warning(fn(*args, **kwargs)) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 1179, in unstack
return self._implementation.unstack(value, name=name) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 193, in wrapped
return _add_should_use_warning(fn(*args, **kwargs)) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/ops/tensor_array_ops.py", line 334, in unstack
indices=math_ops.range(0, num_elements), value=value, name=name) File "/home/zhuhang/Software/anaconda3/envs/py36tensor1/lib/python3.6/site-packages/tensorflow/python/util/tf_should_use.py", line 193, in wrapped
return _add_should_use_warning(fn(*args, **kwargs))
When I run
QuickStarts/STMeta.py
with thest_method='GRU', gclstm_layers=2
, I encountered the following error. How should I fix it?The key error message is as follows:
The complete error message is as follows: