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

Method fill_flt

dnn/test/cuda/chanwise_convolution.cpp:99–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97 }
98
99 void fill_flt() {
100 rng->exec(flt1->tensornd(), {});
101 megdnn_memcpy_D2H(
102 handle, flt1_cpu->ptr(), flt1->ptr(), lflt1.span().dist_byte());
103
104 const size_t IC = lflt1[0], CHL_MUL = lflt1[1], FSIZE = lflt1[3] * lflt1[4];
105
106 // fill flt0 from flt1
107 float* src = flt1_cpu->ptr();
108 float* dst = flt0_cpu->ptr();
109 memset(dst, 0, lflt0.span().dist_byte());
110 for (size_t i = 0; i < IC; ++i) {
111 for (size_t j = 0; j < CHL_MUL; ++j) {
112 memcpy(dst + ((i * CHL_MUL + j) * IC + i) * FSIZE,
113 src + (i * CHL_MUL + j) * FSIZE, FSIZE * sizeof(float));
114 }
115 }
116
117 megdnn_memcpy_H2D(handle, flt0->ptr(), dst, lflt0.span().dist_byte());
118 }
119
120 void fill_dst() {
121 rng->exec(dst0->tensornd(), {});

Callers 1

TEST_FFunction · 0.45

Calls 5

dist_byteMethod · 0.80
spanMethod · 0.80
execMethod · 0.45
tensorndMethod · 0.45
ptrMethod · 0.45

Tested by

no test coverage detected