MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / parse_tensor_shape

Function parse_tensor_shape

src/onnx/onnx_parser.cpp:682–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

680}
681
682static 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
696literal onnx_parser::parse_tensor(const onnx::TensorProto& t) const
697{

Callers 1

parse_tensorMethod · 0.85

Calls 5

is_type_packed_int4Function · 0.85
backMethod · 0.80
get_typeFunction · 0.70
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected