optimum/graphcore/trainer.py
def floating_point_ops(self, inputs: Dict[str, Union[torch.Tensor, Any]]):
        """
        For models that inherit from :class:`~transformers.PreTrainedModel`, uses that method to compute the number of
        floating point operations for every backward + forward pass. If using another model, either implement such a
        method in the model or subclass and override this method.

        Args:
            inputs (:obj:`Dict[str, Union[torch.Tensor, Any]]`):
                The inputs and targets of the model.

        Returns:
            :obj:`int`: The number of floating-point operations.
        """
        # Using self.original_model because self.model is the underlying model used by the IPUs
        # and calling floating_point_ops on it slows things down a lot.
        if hasattr(self.original_model, "floating_point_ops"):
            return self.original_model.floating_point_ops(inputs)
        else:
            return 0

        For models that inherit from :class:`~transformers.PreTrainedModel`, uses that method to compute the number of
        floating point operations for every backward + forward pass. If using another model, either implement such a
        method in the model or subclass and override this method.

        Args:
            inputs (:obj:`Dict[str, Union[torch.Tensor, Any]]`):
                The inputs and targets of the model.

        Returns:
            :obj:`int`: The number of floating-point operations.
        
For models that inherit from :class:`~transformers.PreTrainedModel`, uses that method to compute the number of
floating point operations for every backward + forward pass. If using another model, either implement such a
method in the model or subclass and override this method.
For models that inherit from : class : ` ~transformers . PreTrainedModel ` uses that method to compute the number of floating point operations for every backward + forward pass . If using another model either implement such a method in the model or subclass and override this method .
def floating_point_ops(self, inputs: Dict[str, Union[torch.Tensor, Any]]):
        if hasattr(self.original_model, "floating_point_ops"):
            return self.original_model.floating_point_ops(inputs)
        else:
            return 0
def floating_point_ops ( self , inputs : Dict [ str , Union [ torch . Tensor , Any ] ] ) : if hasattr ( self . original_model , "floating_point_ops" ) : return self . original_model . floating_point_ops ( inputs ) else : return 0
For models that inherit from :class:`~transformers.PreTrainedModel`, uses that method to compute the number of
floating point operations for every backward + forward pass.
For models that inherit from : class : ` ~transformers . PreTrainedModel ` uses that method to compute the number of floating point operations for every backward + forward pass .
"""
        For models that inherit from :class:`~transformers.PreTrainedModel`, uses that method to compute the number of
        floating point operations for every backward + forward pass. If using another model, either implement such a
        method in the model or subclass and override this method.

        Args:
            inputs (:obj:`Dict[str, Union[torch.Tensor, Any]]`):
                The inputs and targets of the model.

        Returns:
            :obj:`int`: The number of floating-point operations.
        """ # Using self.original_model because self.model is the underlying model used by the IPUs # and calling floating_point_ops on it slows things down a lot.
:obj:`int`: The number of floating-point operations.
: obj : ` int ` : The number of floating - point operations .
self
inputs
Dict[str, Union[torch.Tensor, Any]]
inputs (
`Dict[str, Union[torch.Tensor, Any]]`):
The inputs and targets of the model.
` Dict [ str Union [ torch . Tensor Any ]] ` ) : The inputs and targets of the model .