| 104 | |
| 105 | def test_get_opr_seq(): |
| 106 | class Net(M.Module): |
| 107 | def __init__(self): |
| 108 | super().__init__() |
| 109 | self.data = megengine.tensor( |
| 110 | np.random.random((1, 1, 4, 4)), dtype=np.float32 |
| 111 | ) |
| 112 | |
| 113 | def forward(self, input): |
| 114 | A = input.shape[0] |
| 115 | shape = astensor1d((A, A), self.data, dtype="int32", device=input.device) |
| 116 | x = F.reshape(self.data, shape) |
| 117 | o = input + x |
| 118 | return o |
| 119 | |
| 120 | net = Net() |
| 121 | input = megengine.tensor(np.random.random((4, 4)), dtype=np.float32) |
no outgoing calls