MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / tensor_to_c

Function tensor_to_c

src/serialization/impl/extern_c_opr.cpp:87–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85
86template <typename S>
87MGBTensor tensor_to_c(const TensorND<S>& src) {
88 MGBTensor ret;
89 ret.data = const_cast<void*>(static_cast<const void*>(src.raw_ptr()));
90 ret.layout.dtype = dtype_cpp2c(src.dtype());
91 ret.layout.shape = ExternCOprRunner::tensor_shape_to_c(src.shape());
92 return ret;
93}
94
95struct MGBOprDescV23 {
96 size_t nr_input, nr_output;

Callers 1

scn_do_executeMethod · 0.85

Calls 4

dtype_cpp2cFunction · 0.85
raw_ptrMethod · 0.45
dtypeMethod · 0.45
shapeMethod · 0.45

Tested by

no test coverage detected