| 508 | } |
| 509 | |
| 510 | TensorShape 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 | |
| 525 | DType ChannelImpl::get_dtype(Handle handle) { |
| 526 | MGB_LOCK_GUARD(m_spin); |