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

Method alloc

dnn/test/cuda/chanwise_convolution.cpp:72–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 }
71
72 void alloc(
73 size_t N, size_t IC, size_t IH, size_t IW, size_t CHL_MUL, size_t FH,
74 size_t FW, size_t PH, size_t PW) {
75 pad_h = PH;
76 pad_w = PW;
77 auto mkly = [](const TensorShape& s) {
78 return TensorLayout{s, dtype::Float32()};
79 };
80 lsrc = mkly({N, IC, IH, IW});
81 lflt0 = mkly({CHL_MUL * IC, IC, FH, FW});
82 lflt1 = mkly({IC, CHL_MUL, 1, FH, FW});
83 ldst = mkly({N, IC * CHL_MUL, IH - FH + 1 + PH * 2, IW - FW + 1 + PW * 2});
84 src0.reset(new Tensor<>(handle, lsrc));
85 src1.reset(new Tensor<>(handle, lsrc));
86 flt0.reset(new Tensor<>(handle, lflt0));
87 flt0_cpu.reset(new Tensor<>(handle_cpu, lflt0));
88 flt1.reset(new Tensor<>(handle, lflt1));
89 flt1_cpu.reset(new Tensor<>(handle_cpu, lflt1));
90 dst0.reset(new Tensor<>(handle, ldst));
91 dst1.reset(new Tensor<>(handle, ldst));
92 }
93
94 void fill_src() {
95 rng->exec(src0->tensornd(), {});

Callers 1

TEST_FFunction · 0.45

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected