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

Method fill_flt

dnn/test/cuda/chanwise_convolution3d.cpp:95–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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