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

Method as_nd

imperative/src/impl/basic_values.cpp:36–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36HostTensorND HostTensor::as_nd(bool allow_scalar) const {
37 HostTensorND nd;
38 TensorShape tensor_shape;
39 if (m_shape.is_scalar()) {
40 mgb_assert(allow_scalar);
41 tensor_shape = TensorShape{1};
42 } else {
43 tensor_shape = m_shape.as_tensor_shape();
44 }
45 nd.reset(m_storage, {tensor_shape, dtype()});
46 return nd;
47}
48
49std::string DeviceValue::to_string() const {
50 return ssprintf(

Callers 13

numpyMethod · 0.80
_dev_tensorMethod · 0.80
compare_valueMethod · 0.80
init_tensorFunction · 0.80
to_dlpackMethod · 0.80
dumpMethod · 0.80
compileMethod · 0.80
trace_inputMethod · 0.80
reshape_ruleFunction · 0.80
broadcast_ruleFunction · 0.80
apply_transformationMethod · 0.80
apply_transformationMethod · 0.80

Calls 2

is_scalarMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected