Skip to content

SequenceEmpty parameter dtype seems not work #1562

Open

Description

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

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontribution welcomeWe welcome code contributions for this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions