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

Method ptr

src/core/include/megbrain/tensor.h:383–396  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381 //! get ptr at given index
382 template <typename T, typename Iter>
383 T* ptr(Iter idx_begin, Iter idx_end) {
384 auto ptr = this->template ptr<T>();
385 size_t nidx = 0;
386 while (idx_begin != idx_end) {
387 mgb_assert(nidx < m_layout.ndim);
388 size_t idx = *idx_begin;
389 mgb_assert(idx < m_layout.shape[nidx]);
390 ptr += m_layout.stride[nidx] * idx;
391
392 ++idx_begin;
393 ++nidx;
394 }
395 return ptr;
396 }
397
398 template <typename T>
399 T* ptr(std::initializer_list<size_t> idx) {

Callers 15

applyMethod · 0.45
calc_checksumMethod · 0.45
test_free_memFunction · 0.45
tensor.cppFile · 0.45
make_proxyMethod · 0.45
copy_fromMethod · 0.45
prefaultMethod · 0.45
var_alloc_with_shapeMethod · 0.45

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by 6

test_free_memFunction · 0.36
test_basic_input_no_copyFunction · 0.36
TESTFunction · 0.36
test_subtensor_recordFunction · 0.36
TESTFunction · 0.36