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

Function random

python/singa/tensor.py:1817–1829  ·  view source on GitHub ↗

return a random tensor with given shape Args: shape: shape of generated tensor device: device of generated tensor, default is cpu Returns: new tensor generated

(shape, device=get_default_device())

Source from the content-addressed store, hash-verified

1815
1816
1817def random(shape, device=get_default_device()):
1818 ''' return a random tensor with given shape
1819
1820 Args:
1821 shape: shape of generated tensor
1822 device: device of generated tensor, default is cpu
1823
1824 Returns:
1825 new tensor generated
1826 '''
1827 ret = Tensor(shape, device=device)
1828 ret.uniform(0, 1)
1829 return ret
1830
1831
1832def zeros(shape, device=get_default_device()):

Callers

nothing calls this directly

Calls 3

uniformMethod · 0.95
get_default_deviceFunction · 0.85
TensorClass · 0.70

Tested by

no test coverage detected