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

Method create_relayout_out_graph

src/gopt/test/no_memory_copy.cpp:48–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 }
47
48 void create_relayout_out_graph(int mem_forward_opr_type) {
49 input_tensor = m_gen({1, 3, 32, 32}, m_cn);
50 auto input = opr::Host2DeviceCopy::make(*m_network->graph, input_tensor, m_cn)
51 .rename("input");
52 auto f = m_network->add_conv(
53 input, 4, {3, 3}, dtype::Float32(), true, {2, 2}, {0, 0});
54 f = m_network->add_elemwise(
55 {f}, dtype::Float32(), opr::Elemwise::Param::Mode::EXP);
56 f = m_network->add_conv(f, 8, {3, 3}, dtype::Float32(), true, {1, 1}, {1, 1});
57 f = m_network->add_pooling(f, {2, 2}, {2, 2});
58 //! dimshuffle
59 if (mem_forward_opr_type == 0) {
60 f = m_network->add_dimshuffle(f, {0, 2, 3, 1});
61 //! BroadCast
62 } else if (mem_forward_opr_type == 1) {
63 f = m_network->add_broadcast(f);
64 //! Subtensor
65 } else if (mem_forward_opr_type == 2) {
66 f = m_network->add_subtensor(f);
67 //! AxisAddRemove
68 } else if (mem_forward_opr_type == 3) {
69 f = m_network->add_axisaddremove(f);
70 //! Reshape
71 } else if (mem_forward_opr_type == 4) {
72 f = m_network->add_reshape(f);
73 }
74 m_out_var = m_network->add_copy(f);
75 }
76
77 void create_graph_with_subtensor_forward() {
78 input_tensor = m_gen({2, 3, 32, 32}, m_cn);

Callers 1

Calls 11

renameMethod · 0.80
add_convMethod · 0.80
add_elemwiseMethod · 0.80
add_poolingMethod · 0.80
add_dimshuffleMethod · 0.80
add_broadcastMethod · 0.80
add_subtensorMethod · 0.80
add_axisaddremoveMethod · 0.80
add_reshapeMethod · 0.80
add_copyMethod · 0.80
makeFunction · 0.50

Tested by

no test coverage detected