Skip to content
fn

mul_op

→TensorImplPtr
int mul_op(const int & a, const int & b)

Python wrappers

Public Python APIs implemented by this engine symbol.

Public entry point — element-wise multiplication with autograd support.

Math

y=a⋅by = a \cdot b

See Also

add_op, sub_op, div_op

Parameters

a, bconst TensorImplPtr&
Operands of any rank. Shapes must be NumPy-broadcast-compatible.

Returns

TensorImplPtr

Output tensor of shape broadcast_shapes(a.shape, b.shape) and promoted dtype. Participates in autograd via MulBackward.

Raises

LucidError
If a and b have incompatible shapes under NumPy broadcasting rules, or if their devices differ.

Examples

>>> auto c = mul_op(a, b);    // c = a * b (Hadamard / elementwise)