| 680 | } |
| 681 | |
| 682 | static shape parse_tensor_shape(const onnx::TensorProto& t) |
| 683 | { |
| 684 | std::vector<std::size_t> dims(t.dims().begin(), t.dims().end()); |
| 685 | if(is_type_packed_int4(t)) |
| 686 | { |
| 687 | auto dim_n = dims.back(); |
| 688 | if(dim_n > 0 and (dim_n % 2 == 0)) |
| 689 | dims.back() = dim_n / 2; // int4-packed dimension converted to int8-sized units |
| 690 | else |
| 691 | MIGRAPHX_THROW("Int4: currently supports only even-sized packed tensors"); |
| 692 | } |
| 693 | return shape{get_type(t.data_type()), dims}; |
| 694 | } |
| 695 | |
| 696 | literal onnx_parser::parse_tensor(const onnx::TensorProto& t) const |
| 697 | { |
no test coverage detected