Skip to content

AddCastNode in insert_cast_transformer.cc sets invalid dtype -1 #16449

Open
@justinchuby

Description

@justinchuby

Describe the issue

ORT executing the fp16 model

<
   ir_version: 3,
   opset_import: ["" : 1]
>
node_graph (float16[2,3] input0) => (float16[2,3] output0) {
   output0 = RandomNormalLike <mean = 1.1, scale = 1.0> (input0)
}

with CPU will produce an error

onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : This is an invalid model. In Node, ("InsertedCast_input0", Cast, "", -1) : ("input0": tensor(float16),) -> ("InsertedCast_input0": tensor(float),) , Error Mismatched attribute type in 'InsertedCast_input0 : to'

It appears to_type was somehow set to -1 in https://github.com/microsoft/onnxruntime/blob/3c2d52a995954cd9ce24b2831060c4326ab18e1c/onnxruntime/core/optimizer/insert_cast_transformer.cc#L28C23-L47

To reproduce

As above

Urgency

No response

Platform

Linux

OS Version

Ubuntu 22.04

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.15.0

ONNX Runtime API

Python

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

Labels

converter:dynamoissues related supporting the PyTorch Dynamo exportercore runtimeissues related to core runtime

Type

No type

Projects

Status

Filed Bugs

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions