microsoft / nnfusion

A flexible and efficient deep neural network (DNN) compiler that generates high-performance executable from a DNN model description.
MIT License
952 stars 158 forks source link

[BUG] shape size mismatch for Constant op with FP16 #385

Open jlxue opened 2 years ago

jlxue commented 2 years ago

šŸ› Bug

shape size mismatch for Constant op with FP16

To Reproduce Steps to reproduce the behavior:

  1. save a ONNX fp16 model with constant tensor
  2. compile with nnfusion

Expected behavior

[INFO] 2022-02-24T02:46:45z src/nnfusion/frontend/onnx_import/onnx.cpp 40 Import ONNX Graph Size: [51077182] [INFO] 2022-02-24T02:46:45z src/nnfusion/frontend/onnx_import/util/graph_convert.cpp 317 Converting Onnx Graph [ERROR] 2022-02-24T02:46:45z src/nnfusion/util/errors.hpp 169 While validating op 'Constant_0' of type 'Constant': Check failed: 'values.size() == 1 || values.size() == nnfusion::shape_size(m_shape)' at /home/jxue/repo/nnfusion-jlxue/src/nnfusion/core/operators/op_define/constant.hpp:54: Did not get the expected number of literals for a constant of shape Shape{1000, 2048} (got 1024000, expected 1 or 2048000). terminate called after throwing an instance of 'nnfusion::errors::CheckError' what(): While validating op 'Constant_0' of type 'Constant': Check failed: 'values.size() == 1 || values.size() == nnfusion::shape_size(m_shape)' at /home/jxue/repo/nnfusion-jlxue/src/nnfusion/core/operators/op_define/constant.hpp:54: Did not get the expected number of literals for a constant of shape Shape{1000, 2048} (got 1024000, expected 1 or 2048000). Aborted (core dumped) Additional context