Avoid unnecessary tensor materialization in tensor-scalar op derivatives. (#882)
Avoid unnecessary tensor materialization in tensor-scalar op derivatives. (#882)

Avoid unnecessary tensor materialization in the pullback of
`(Tensor, Scalar) -> Tensor` binary operations, like `Tensor * Scalar`.

Add extra derivatives for these operations with respect to only the `Tensor`
arguments.

This avoids unnecessary work to compute the derivative with respect to `Scalar`
arguments, which involves calls to `Tensor.scalarized()` that trigger X10 tensor
materialization.

Co-authored-by: Parker Schuh <9a423216896b5e225937274b4c625b69ad2391c2@google.com>
tensorflow/swift-apis,tensorflow/swift-apis,tensorflow/swift-apis,tensorflow/swift-apis,tensorflow/swift-apis