MCPcopy Create free account
hub / github.com/MegEngine/MegCC / dnntensor_2_ccoperand

Function dnntensor_2_ccoperand

compiler/test/kernel/common/src/cc_proxy_utils.h:69–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 return "invalid";
68}
69megcc::CCOperand dnntensor_2_ccoperand(
70 const megdnn::TensorND& tensor, bool is_dynamic) {
71 megcc::CCOperand res;
72 size_t unknow_shape = std::numeric_limits<size_t>::max();
73 for (size_t i = 0; i < tensor.layout.ndim; ++i) {
74 if (is_dynamic) {
75 res.shape.push_back(unknow_shape);
76 } else {
77 res.shape.push_back(tensor.layout[i]);
78 }
79 }
80 auto dtype_enum = tensor.layout.dtype.enumv();
81 if (dtype_enum == megdnn::DTypeEnum::QuantizedS8) {
82 res.scale = tensor.layout.dtype.param<megdnn::dtype::QuantizedS8>().scale;
83 } else if (dtype_enum == megdnn::DTypeEnum::QuantizedS32) {
84 res.scale = tensor.layout.dtype.param<megdnn::dtype::QuantizedS32>().scale;
85 }
86 res.dtype = dnndtype_2_str(tensor.layout.dtype, res.scale);
87 return res;
88}
89void fill_operands(
90 std::unordered_map<std::string, CCAttr>& map, const TensorNDArray& tensors,
91 OutputScope output_idx, bool is_dynamic) {

Callers 1

fill_operandsFunction · 0.85

Calls 2

maxFunction · 0.85
dnndtype_2_strFunction · 0.85

Tested by

no test coverage detected