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

Function _call_singa_func

python/singa/tensor.py:1757–1774  ·  view source on GitHub ↗

this function calls singa global functions that returns Tensor and create new python Tensor instance e.g., Tensor [singa_func](args...) Args: _singa_func: singa CPP API args: args for singa CPP API Returns: new singa tensor

(_singa_func, *args)

Source from the content-addressed store, hash-verified

1755
1756
1757def _call_singa_func(_singa_func, *args):
1758 ''' this function calls singa global functions that returns Tensor
1759 and create new python Tensor instance
1760 e.g., Tensor [singa_func](args...)
1761
1762 Args:
1763 _singa_func: singa CPP API
1764 args: args for singa CPP API
1765
1766 Returns:
1767 new singa tensor
1768 '''
1769 new_t = Tensor()
1770 new_t.data = _singa_func(*args)
1771 new_t.shape = tuple(new_t.data.shape())
1772 new_t.device = new_t.data.device()
1773 new_t.dtype = new_t.data.data_type()
1774 return new_t
1775
1776
1777def copy_from_numpy(data, np_array):

Callers 15

cloneMethod · 0.70
TMethod · 0.70
copyMethod · 0.70
__add__Method · 0.70
__sub__Method · 0.70
__mul__Method · 0.70
__div__Method · 0.70
__floordiv__Method · 0.70
__lt__Method · 0.70
__le__Method · 0.70
__gt__Method · 0.70
__ge__Method · 0.70

Calls 5

shapeMethod · 0.80
deviceMethod · 0.80
data_typeMethod · 0.80
TensorClass · 0.70
tupleFunction · 0.50

Tested by

no test coverage detected