Skip to content

The kernel_shape of keras.layers.Conv1D may be wrong #1807

Open
@maybeLee

Description

@maybeLee

Describe the bug
Not sure if it is the intended behavior. I was using keras to build the model and then convert to ONNX through tf2onnx.convert.from_keras However, I notice the kernel_shape in ONNX is INTS instead of INT when I was trying to convert Conv1D.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 20.04
  • Tensorflow Version: 2.7
  • Python version: 3.7

To Reproduce

import tensorflow as tf
import tf2onnx

x = tf.keras.layers.Input((32,3))
y = tf.keras.layers.Conv1D(3,3)(x)
model = tf.keras.Model(x,y)
model.summary()
input_shape = model.layers[0].input_shape[0]
spec = (tf.TensorSpec(input_shape, tf.float32, name="input"),)
model, _ = tf2onnx.convert.from_keras(model, input_signature=spec, \
        opset=15, output_path="temp")
print(model.graph.node[2])

You may access the code here:
https://colab.research.google.com/drive/19hoAWV79v7eXiAsQ3yL5Zbfg8oNSn4H6?usp=sharing

Screenshots
image

It seems that the attribute of Conv1D should be INT with only one int 3, instead of INTS with two ints. This situation also happens in the stride and dilations.

Metadata

Metadata

Assignees

Labels

potential bugError in codebase may cause a bug, but no concrete examples observed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions