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

Function fma4_extra_opr_impl

dnn/test/common/elemwise.cpp:25–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25void fma4_extra_opr_impl(const TensorNDArray& data) {
26 megdnn_assert(data.size() == 5);
27 std::vector<uint8_t> tmp_storage(data[4].layout.span().dist_byte());
28 TensorND tmp;
29 tmp.reset_ptr(tmp_storage.data());
30 tmp.layout = data[4].layout;
31 tmp.layout.init_contiguous_stride();
32 auto handle = create_cpu_handle(2);
33 auto opr = handle->create_operator<Elemwise>();
34 using Mode = Elemwise::Mode;
35 opr->param().mode = Mode::MUL;
36 opr->exec({data[0], data[1]}, data[4]);
37 opr->exec({data[2], data[3]}, tmp);
38 opr->param().mode = Mode::ADD;
39 opr->exec({tmp, data[4]}, data[4]);
40}
41
42TensorLayout make_layout(
43 const TensorShape& shp, std::initializer_list<ptrdiff_t> stride) {

Callers

nothing calls this directly

Calls 8

dist_byteMethod · 0.80
spanMethod · 0.80
reset_ptrMethod · 0.80
sizeMethod · 0.45
dataMethod · 0.45
paramMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected