optimum/graphcore/trainer.py
def _prepare_input(self, data: Union[torch.Tensor, Any]) -> Union[torch.Tensor, Any]:
        """
        Prepares one :obj:`data` before feeding it to the model, be it a tensor or a nested list/dictionary of tensors.
        """
        if isinstance(data, dict):
            return type(data)(**{k: self._prepare_input(v) for k, v in data.items()})
        elif isinstance(data, (tuple, list)):
            return type(data)(self._prepare_input(v) for v in data)
        elif isinstance(data, torch.Tensor):
            return data
        return data

        Prepares one :obj:`data` before feeding it to the model, be it a tensor or a nested list/dictionary of tensors.
        
Prepares one :obj:`data` before feeding it to the model, be it a tensor or a nested list/dictionary of tensors.
Prepares one : obj : ` data ` before feeding it to the model be it a tensor or a nested list / dictionary of tensors .
def _prepare_input(self, data: Union[torch.Tensor, Any]) -> Union[torch.Tensor, Any]:
        if isinstance(data, dict):
            return type(data)(**{k: self._prepare_input(v) for k, v in data.items()})
        elif isinstance(data, (tuple, list)):
            return type(data)(self._prepare_input(v) for v in data)
        elif isinstance(data, torch.Tensor):
            return data
        return data
def _prepare_input ( self , data : Union [ torch . Tensor , Any ] ) -> Union [ torch . Tensor , Any ] : if isinstance ( data , dict ) : return type ( data ) ( ** { k : self . _prepare_input ( v ) for k , v in data . items ( ) } ) elif isinstance ( data , ( tuple , list ) ) : return type ( data ) ( self . _prepare_input ( v ) for v in data ) elif isinstance ( data , torch . Tensor ) : return data return data
Prepares one :obj:`data` before feeding it to the model, be it a tensor or a nested list/dictionary of tensors.
Prepares one : obj : ` data ` before feeding it to the model be it a tensor or a nested list / dictionary of tensors .
"""
        Prepares one :obj:`data` before feeding it to the model, be it a tensor or a nested list/dictionary of tensors.
        """
self
data
Union[torch.Tensor, Any]