MCPcopy Create free account
hub / github.com/apache/singa / _conv2d_helper

Method _conv2d_helper

test/python/test_onnx.py:55–69  ·  view source on GitHub ↗
(self, dev)

Source from the content-addressed store, hash-verified

53 (_tuple_to_string(actual), _tuple_to_string(expect)))
54
55 def _conv2d_helper(self, dev):
56 x = tensor.Tensor(shape=(2, 3, 3, 3), device=dev)
57 x.gaussian(0.0, 1.0)
58 y = layer.Conv2d(1, 2)(x)
59
60 # frontend
61 model = sonnx.to_onnx([x], [y])
62 # backend
63 sg_ir = sonnx.prepare(model, device=dev)
64 sg_ir.is_graph = True
65 y_t = sg_ir.run([x])
66
67 np.testing.assert_array_almost_equal(tensor.to_numpy(y),
68 tensor.to_numpy(y_t[0]),
69 decimal=5)
70
71 def test_conv2d_cpu(self):
72 self._conv2d_helper(cpu_dev)

Callers 2

test_conv2d_cpuMethod · 0.95
test_conv2d_gpuMethod · 0.95

Calls 4

gaussianMethod · 0.95
TensorMethod · 0.80
prepareMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected