Open
Description
openedon May 22, 2024
behavior
When create an empty sequence by SequenceEmpty, the dtype parameter seems does not work. Although in the code the type of the sequence and tensor to be inserted are the same. But sequence dtype seems always be float.
In the following code, the second and third parts will fail. The first work because the tensor is also float.
code to reproduce
from onnxscript import script, opset20 as op
import onnx
import numpy as np
@script()
def test(img_in):
seq = op.SequenceEmpty(dtype=onnx.TensorProto.FLOAT)
seq = op.SequenceInsert(seq, img_in)
return seq
img_in = np.random.randn(128, 256).astype(np.float32)
res = test(img_in)
@script()
def test(img_in):
seq = op.SequenceEmpty(dtype=onnx.TensorProto.FLOAT16)
seq = op.SequenceInsert(seq, img_in)
return seq
img_in = np.random.randn(128, 256).astype(np.float16)
res = test(img_in)
@script()
def test(img_in):
seq = op.SequenceEmpty(dtype=onnx.TensorProto.DOUBLE)
seq = op.SequenceInsert(seq, img_in)
return seq
img_in = np.random.randn(128, 256).astype(np.float64)
res = test(img_in)
error message
Fail: [ONNXRuntimeError] : 1 : FAIL : Node () Op (SequenceInsert) [TypeInferenceError] Input Sequence and Tensor are expected to have the same elem type. Sequence=1 Tensor=11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment