| 244 | } |
| 245 | |
| 246 | void TensorImplDft::fill_zero() { |
| 247 | if (is_host()) { |
| 248 | auto mge_layout = m_host_tensor->layout(); |
| 249 | if (m_host_tensor->layout().is_physical_contiguous()) { |
| 250 | auto ptr = get_memory_ptr(); |
| 251 | std::memset(ptr, 0, mge_layout.dtype.size(mge_layout.total_nr_elems())); |
| 252 | } else { |
| 253 | TensorImplDft tmp( |
| 254 | LiteDeviceType::LITE_CPU, to_lite_layout(mge_layout), true); |
| 255 | tmp.fill_zero(); |
| 256 | this->copy_from(&tmp); |
| 257 | } |
| 258 | } else { |
| 259 | mgb::dev_tensor_memset(*m_dev_tensor, 0); |
| 260 | m_dev_tensor->sync(); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | void TensorImplDft::share_memory_with(const TensorImplBase* src_tensor_impl) { |
| 265 | auto src_dft_tensor = static_cast<const TensorImplDft*>(src_tensor_impl); |
nothing calls this directly
no test coverage detected