MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / _test_conv2d

Function _test_conv2d

python/oneflow/test/modules/test_conv2d.py:1154–1164  ·  view source on GitHub ↗
(
    test_case, conv, data, weight, output, bias=None, device="cuda",
)

Source from the content-addressed store, hash-verified

1152
1153
1154def _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
1167def _test_conv2d_backward(

Callers 7

test_conv2dMethod · 0.85
test_conv2d_with_biasMethod · 0.85
test_conv2d_groupMethod · 0.85
test_conv2d_paddingMethod · 0.85
test_conv2d_strideMethod · 0.85
test_conv2d_kernelMethod · 0.85
test_conv2d_dilationMethod · 0.85

Calls 5

ParameterMethod · 0.80
numpyMethod · 0.80
deviceMethod · 0.45
TensorMethod · 0.45
toMethod · 0.45

Tested by

no test coverage detected