(
test_case, conv, data, weight, output, bias=None, device="cuda",
)
| 1152 | |
| 1153 | |
| 1154 | def _test_conv2d( |
| 1155 | test_case, conv, data, weight, output, bias=None, device="cuda", |
| 1156 | ): |
| 1157 | to_device = flow.device(device) |
| 1158 | x = flow.tensor(data, dtype=flow.float32, device=to_device) |
| 1159 | conv.weight = flow.nn.Parameter(flow.Tensor(weight)) |
| 1160 | if bias is not None: |
| 1161 | conv.bias = flow.nn.Parameter(flow.Tensor(bias)) |
| 1162 | conv.to(to_device) |
| 1163 | of_out = conv(x) |
| 1164 | test_case.assertTrue(np.allclose(of_out.numpy(), output, rtol=1e-4, atol=1e-8)) |
| 1165 | |
| 1166 | |
| 1167 | def _test_conv2d_backward( |
no test coverage detected