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

Method shape

imperative/python/src/tensor.cpp:671–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

669}
670
671PyObject* TensorWrapper::shape() {
672 auto shape = m_tensor->shape();
673
674 if (!shape) {
675 Py_RETURN_NONE;
676 }
677 py::tuple ret(shape->ndim);
678 for (size_t i = 0; i < shape->ndim; ++i) {
679 ret[i] = shape->at(i);
680 }
681 return ret.release().ptr();
682}
683
684PyObject* TensorWrapper::dtype() {
685 return py::cast(m_tensor->dtype()).release().ptr();

Callers 13

forward_computeFunction · 0.45
backward_computeFunction · 0.45
init_graph_rtFunction · 0.45
pyarr2hvalFunction · 0.45
numpyMethod · 0.45
compare_valueMethod · 0.45
init_tensorFunction · 0.45
ndarray_from_tensorFunction · 0.45
to_dlpackMethod · 0.45
get_ndim_safeFunction · 0.45
_expand_dims_cppFunction · 0.45
_squeeze_cppFunction · 0.45

Calls 3

atMethod · 0.45
ptrMethod · 0.45
releaseMethod · 0.45

Tested by 2

forward_computeFunction · 0.36
backward_computeFunction · 0.36