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

Method get_shape

imperative/src/impl/interpreter/interpreter_impl.cpp:510–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508}
509
510TensorShape ChannelImpl::get_shape(Handle handle) {
511 MGB_LOCK_GUARD(m_spin);
512 assert_available();
513 mgb_assert(
514 m_valid_handle.find(handle) != m_valid_handle.end(), "invalid handle: %p",
515 handle);
516 auto info = reinterpret_cast<TensorInfo*>(handle);
517 if (info->shape_valid()) {
518 return info->desc.layout;
519 }
520 TensorShape ret = wait_tensor(info, TensorProp::Shape)->layout();
521 mgb_assert(ret.ndim > 0);
522 return ret;
523}
524
525DType ChannelImpl::get_dtype(Handle handle) {
526 MGB_LOCK_GUARD(m_spin);

Callers 2

TESTFunction · 0.80
shapeMethod · 0.80

Calls 4

findMethod · 0.45
endMethod · 0.45
shape_validMethod · 0.45
layoutMethod · 0.45

Tested by 1

TESTFunction · 0.64