| 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); |
no test coverage detected