'Compute loss numerator and denominator for one shard of output.'

def loss(self, top_out, targets, weights_fn=common_layers.weights_nonzero):

    logits = top_out
    return common_layers.padded_cross_entropy(logits, targets, self._model_hparams.label_smoothing, weights_fn=weights_fn)
