tl;dr Is there a way to get 0 when dividing by 0 in Gluon F.broadcast_div() instead of
I’m attempting to rewrite the Tensorflow seq2seq sequence_loss function for Gluon. The source is at addons/loss.py at v0.13.0 · tensorflow/addons · GitHub. 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
inf. Does anyone have any suggestions for mimicking this behavior in Gluon?