Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert fail Cannot reshape a tensor #54

Open
ZTMIDGO opened this issue Sep 15, 2023 · 1 comment
Open

Convert fail Cannot reshape a tensor #54

ZTMIDGO opened this issue Sep 15, 2023 · 1 comment

Comments

@ZTMIDGO
Copy link

ZTMIDGO commented Sep 15, 2023

Checking 0/1...
INFO:deformation_layers ::Reshape will process tensor after change back to NCHW format.
Traceback (most recent call last):
File "D:\python\onnx2tflite\converter.py", line 108, in
run()
File "D:\python\onnx2tflite\converter.py", line 92, in run
onnx_converter(
File "D:\python\onnx2tflite\converter.py", line 21, in onnx_converter
keras_model = keras_builder(model_proto, native_groupconv)
File "D:\python\onnx2tflite\utils\builder.py", line 82, in keras_builder
tf_tensor[node_outputs[index]] = tf_operator(tf_tensor, onnx_weights, node_inputs, op_attr, index=index)(_inputs)
File "D:\python\onnx2tflite\layers\deformation_layers.py", line 97, in call
inputs = tf.reshape(inputs, shape=self.out_shape)
File "D:\python\onnx2tflite\venv\lib\site-packages\tensorflow\python\util\traceback_utils.py", line 153, in error_handler
raise e.with_traceback(filtered_tb) from None
File "D:\python\onnx2tflite\venv\lib\site-packages\keras\src\layers\core\tf_op_layer.py", line 119, in handle
return TFOpLambda(op)(*args, **kwargs)
File "D:\python\onnx2tflite\venv\lib\site-packages\keras\src\utils\traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
ValueError: Exception encountered when calling layer "tf.reshape" (type TFOpLambda).

Cannot reshape a tensor with 8388608 elements to shape [0,1,?] (0 elements) for '{{node tf.reshape/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT64](Placeholder, tf.reshape/Reshape/shape)' with input shapes: [1,32,512,512], [3] and with input tensors computed as partial shapes: input[1] = [0,1,?].

Call arguments received by layer "tf.reshape" (type TFOpLambda):
• tensor=tf.Tensor(shape=(1, 32, 512, 512), dtype=float32)
• shape=array([ 0, 1, -1], dtype=int64)
• name=None

@ZTMIDGO
Copy link
Author

ZTMIDGO commented Sep 15, 2023

ONNX MODEL:
onnx.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant