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

Method alloc

dnn/test/rocm/chanwise_convolution.cpp:67–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

TEST_FFunction · 0.45

Calls 1

resetMethod · 0.45

Tested by

no test coverage detected