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

Function eltwise_mult

python/singa/tensor.py:1278–1299  ·  view source on GitHub ↗

Elementi-wise multiplication. Args: lhs (Tensor): lhs tensor rhs (Tensor): rhs tensor ret (Tensor, optional): if not None, the result is stored in it; otherwise, a new Tensor would be created for the result. Returns: the result Tensor

(lhs, rhs, ret=None)

Source from the content-addressed store, hash-verified

1276
1277
1278def eltwise_mult(lhs, rhs, ret=None):
1279 '''Elementi-wise multiplication.
1280
1281 Args:
1282 lhs (Tensor): lhs tensor
1283 rhs (Tensor): rhs tensor
1284 ret (Tensor, optional): if not None, the result is stored in it;
1285 otherwise, a new Tensor would be created for the result.
1286
1287 Returns:
1288 the result Tensor
1289 '''
1290
1291 if ret is None:
1292 # call Tensor.__mul__()
1293 return lhs * rhs
1294 else:
1295 if isinstance(rhs, Tensor):
1296 singa.EltwiseMult(lhs.data, rhs.data, ret.data)
1297 else:
1298 singa.EltwiseMultFloatWithRet(lhs.data, rhs, ret.data)
1299 return ret
1300
1301
1302def mult(A, B, C=None, alpha=1.0, beta=0.0):

Callers 1

einsumFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected