Elementwise
elementwise.add
tensor.add — elementwise a + b, numpy-style broadcasting.
Signature: elementwise.add((a, b))
elementwise.add_backward
tensor.add_backward — da = g, db = g, each unbroadcast.
Signature: elementwise.add_backward((a, b, g))
elementwise.div
tensor.div — elementwise a / b, numpy-style broadcasting. x/0
is inf/NaN, matching the scalar / (and therefore the host op — the serde_json wire then carries null, which both sides reject on re-decode identically).
Signature: elementwise.div((a, b))
elementwise.div_backward
tensor.div_backward — da = g/b, db = −g·a/b², unbroadcast.
Signature: elementwise.div_backward((a, b, g))
elementwise.mul
tensor.mul — elementwise a * b, numpy-style broadcasting.
Signature: elementwise.mul((a, b))
elementwise.mul_backward
tensor.mul_backward — da = g·b, db = g·a, unbroadcast.
Signature: elementwise.mul_backward((a, b, g))
elementwise.sub
tensor.sub — elementwise a - b, numpy-style broadcasting.
Signature: elementwise.sub((a, b))
elementwise.sub_backward
tensor.sub_backward — da = g, db = −g, unbroadcast.
Signature: elementwise.sub_backward((a, b, g))
elementwise.unbroadcast
unbroadcast(gd, gsh, tsh) — the adjoint of broadcasting: sum the
flat grad gd (shape gsh) down to tsh, summing out leading dims tsh lacks and any dim where tsh is 1 but gsh is larger (mirrors unbroadcast in host-tensor's elementwise.rs).
Signature: elementwise.unbroadcast((gd, gsh, tsh))