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

Function exec_mesh_indexing

dnn/src/naive/mesh_indexing/opr_impl.cpp:37–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35/* =========================== MeshIndexing ============================ */
36template <typename T>
37void exec_mesh_indexing(
38 const TensorND& src_tensor, const MeshIndexing::IndexDesc& desc,
39 const TensorND& dst_tensor) {
40 // normal mesh indexing.
41 auto iter = tensor_iter<T>(dst_tensor).begin();
42 size_t ndim = dst_tensor.layout.ndim;
43 auto ptr = src_tensor.ptr<T>();
44 for (size_t dst_idx = 0; dst_idx < dst_tensor.layout.total_nr_elems(); ++dst_idx) {
45 int index[TensorShape::MAX_NDIM];
46 std::copy(iter.idx(), iter.idx() + ndim, index);
47 size_t src_idx = get_index(src_tensor, dst_tensor, desc, index);
48 *iter = ptr[src_idx];
49 ++iter;
50 }
51}
52
53void MeshIndexingImpl::exec(
54 _megdnn_tensor_in src, const IndexDesc& desc, _megdnn_tensor_out dst,

Callers

nothing calls this directly

Calls 5

idxMethod · 0.80
get_indexFunction · 0.70
copyFunction · 0.50
beginMethod · 0.45
total_nr_elemsMethod · 0.45

Tested by

no test coverage detected