Skip to content

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

@justinchuby

Description

@justinchuby
Contributor

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

Activity

changed the title [-]AddCastNode `insert_cast_transformer.cc` sets invalid dtype `-1`[/-] [+]`AddCastNode` in `insert_cast_transformer.cc` sets invalid dtype `-1`[/+] on Jun 21, 2023
added this to the 1.17 milestone on Sep 14, 2023
BowenBao

BowenBao commented on Oct 17, 2023

@BowenBao
Contributor
thiagocrepaldi

thiagocrepaldi commented on May 1, 2024

@thiagocrepaldi
Contributor

Still waiting on ORT update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

Status

Filed Bugs

Relationships

None yet

    Participants

    @thiagocrepaldi@BowenBao@justinchuby

    Issue actions

      `AddCastNode` in `insert_cast_transformer.cc` sets invalid dtype `-1` · Issue #16449 · microsoft/onnxruntime