Hi all,

tl;dr Is there a way to get 0 when dividing by 0 in Gluon F.broadcast_div() 
instead of ```nan``` or ```inf```?

I'm attempting to rewrite the Tensorflow seq2seq sequence_loss function for 
Gluon. The source is at 
https://github.com/tensorflow/addons/blob/v0.13.0/tensorflow_addons/seq2seq/loss.py#L24-L169.
 Line 160 has the following:

```
crossent = tf.math.divide_no_nan(crossent, total_size)
```

which outputs 0 when dividing by 0. On the other hand, Gluon's 
F.broadcast_div() will output something like ```nan``` or ```inf```. Does 
anyone have any suggestions for mimicking this behavior in Gluon?

Thanks!





---
[Visit 
Topic](https://discuss.mxnet.apache.org/t/make-ndarray-or-symbol-output-0-when-dividing-by-0/7005/1)
 or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.mxnet.apache.org/email/unsubscribe/96a4a650bab0b01358c959d17d1dc4a657bec3bc7df06b93339f1d718267d26e).

Reply via email to