def get_normalized_probs(self, net_output, log_probs, sample):
        """
        Get normalized probabilities (or log probs) from a net's output.
        Pointer-generator network output is already normalized.
        """
        probs = net_output[0]
        # Make sure the probabilities are greater than zero when returning log
        # probabilities.
        return probs.clamp(1e-10, 1.0).log() if log_probs else probs

        Get normalized probabilities (or log probs) from a net's output.
        Pointer-generator network output is already normalized.
        
decoding/IAD/fairseq/examples/pointer_generator/pointer_generator_src/transformer_pg.py