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

Method share_memory_with

lite/src/mge/tensor_impl.cpp:264–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264void TensorImplDft::share_memory_with(const TensorImplBase* src_tensor_impl) {
265 auto src_dft_tensor = static_cast<const TensorImplDft*>(src_tensor_impl);
266 LITE_ASSERT(
267 is_host() == src_dft_tensor->is_host(),
268 "share memory must happen in same device");
269 //! make shape the src memory is ready
270 src_tensor_impl->get_memory_ptr();
271 if (is_host()) {
272 *m_host_tensor = *src_dft_tensor->m_host_tensor;
273 } else {
274 *m_dev_tensor = *src_dft_tensor->m_dev_tensor;
275 }
276}
277
278void TensorImplDft::set_layout(const Layout& layout) {
279 bool host = is_host();

Callers

nothing calls this directly

Calls 2

is_hostMethod · 0.80
get_memory_ptrMethod · 0.45

Tested by

no test coverage detected