| 34 | } |
| 35 | |
| 36 | HostTensorND 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 | |
| 49 | std::string DeviceValue::to_string() const { |
| 50 | return ssprintf( |
no test coverage detected