fn
mul
→Tensormul(input: Tensor, other: Tensor | Scalar)Element-wise multiplication (Hadamard product) with broadcasting.
Computes input * other element-wise. For matrix multiplication see matmul / mm.
Parameters
inputTensorLeft operand.
otherTensor or scalarRight operand. Broadcasts against
input following the standard
broadcasting rules; Python scalars are promoted to a tensor of matching
dtype.Returns
TensorElement-wise result with shape broadcast(input.shape, other.shape) and
dtype determined by the usual type-promotion rules.
Notes
Mathematical definition:
Autograd: , .
Examples
>>> import lucid
>>> a = lucid.tensor([1.0, 2.0, 3.0])
>>> b = lucid.tensor([4.0, 5.0, 6.0])
>>> lucid.mul(a, b)
Tensor([...])