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

Function eltwise_mult

examples/model_selection/Trails/singa_pkg_code/tensor.py:1243–1264  ·  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

1241
1242
1243def eltwise_mult(lhs, rhs, ret=None):
1244 '''Elementi-wise multiplication.
1245
1246 Args:
1247 lhs (Tensor): lhs tensor
1248 rhs (Tensor): rhs tensor
1249 ret (Tensor, optional): if not None, the result is stored in it;
1250 otherwise, a new Tensor would be created for the result.
1251
1252 Returns:
1253 the result Tensor
1254 '''
1255
1256 if ret is None:
1257 # call Tensor.__mul__()
1258 return lhs * rhs
1259 else:
1260 if isinstance(rhs, Tensor):
1261 singa.EltwiseMult(lhs.data, rhs.data, ret.data)
1262 else:
1263 singa.EltwiseMultFloatWithRet(lhs.data, rhs, ret.data)
1264 return ret
1265
1266
1267def 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