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

Method _tile_helper

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

Source from the content-addressed store, hash-verified

1855 self._gather_helper(gpu_dev)
1856
1857 def _tile_helper(self, dev):
1858 X = np.array([0, 1, 2]).astype(np.float32)
1859 x = tensor.from_numpy(X)
1860 x.to_device(dev)
1861 y = autograd.tile(x, [2, 2])
1862
1863 # frontend
1864 model = sonnx.to_onnx([x], [y])
1865 # print('The model is:\n{}'.format(model))
1866
1867 # backend
1868 sg_ir = sonnx.prepare(model, device=dev)
1869 sg_ir.is_graph = True
1870 y_t = sg_ir.run([x])
1871
1872 np.testing.assert_array_almost_equal(
1873 tensor.to_numpy(y).shape,
1874 tensor.to_numpy(y_t[0]).shape)
1875
1876 def test_tile_cpu(self):
1877 self._tile_helper(cpu_dev)

Callers 2

test_tile_cpuMethod · 0.95
test_tile_gpuMethod · 0.95

Calls 3

prepareMethod · 0.80
to_deviceMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected