opened
ManrajGrover
username_0
To get help from the community, check out our [Google group](https://groups.google.com/a/tensorflow.org/forum/#!forum/tfjs).

#### TensorFlow.js version
0.11.9

#### Browser version
Version 67.0.3396.87 (Official Build) (64-bit)

#### Describe the problem or feature request
tf.computeWeightedLoss currently does not apply [broadcast](https://github.com/tensorflow/tfjs-core/blob/master/src/ops/loss_ops.ts#L69) on `Reduction.SUM_BY_NONZERO_WEIGHTS` before calculating non-zero values. This leads to wrong output. See [tensorflow implementation](https://github.com/tensorflow/tensorflow/blob/r1.8/tensorflow/python/ops/losses/losses_impl.py#L148). Found it while working on https://github.com/tensorflow/tfjs-core/pull/1120

#### Code to reproduce the bug / link to feature request
```js
const losses = tf.tensor2d([[0, 0, 1], [1, 0, 0], [0, 1, 0]], [3, 3]);
const weights = tf.tensor2d([[0.1, 0.2, 0.3]]);

tf.losses.computeWeightedLoss(losses, weights).print();
// Tensor
//    0.20000001788139343 (should be 0.06666667014360428)
```
tf.computeWeightedLoss should apply broadcast before reduction 
issue
created
ManrajGrover
username_0
I can take this one up.
comment
closed
nsthorat
username_1
issue