paddlenlp/metrics/glue.py
def update(self, preds_and_labels):
        """
        Ensures the type of preds and labels is numpy.ndarray and reshapes them
        into [-1, 1].

        Args:
            preds_and_labels (tuple[Tensor] or list[Tensor]):
                Tuple or list of predicted value and the ground truth label.
                Its data type should be float32 or float64 and its shape is [batch_size, d0, ..., dN].

        """
        preds = preds_and_labels[0]
        labels = preds_and_labels[1]
        if isinstance(preds, paddle.Tensor):
            preds = preds.numpy()
        if isinstance(labels, paddle.Tensor):
            labels = labels.numpy()
        preds = np.squeeze(preds.reshape(-1, 1)).tolist()
        labels = np.squeeze(labels.reshape(-1, 1)).tolist()
        self.preds.append(preds)
        self.labels.append(labels)

        Ensures the type of preds and labels is numpy.ndarray and reshapes them
        into [-1, 1].

        Args:
            preds_and_labels (tuple[Tensor] or list[Tensor]):
                Tuple or list of predicted value and the ground truth label.
                Its data type should be float32 or float64 and its shape is [batch_size, d0, ..., dN].

        
Ensures the type of preds and labels is numpy.ndarray and reshapes them
into [-1, 1].
Ensures the type of preds and labels is numpy . ndarray and reshapes them into [ - 1 1 ] .
def update(self, preds_and_labels):
        preds = preds_and_labels[0]
        labels = preds_and_labels[1]
        if isinstance(preds, paddle.Tensor):
            preds = preds.numpy()
        if isinstance(labels, paddle.Tensor):
            labels = labels.numpy()
        preds = np.squeeze(preds.reshape(-1, 1)).tolist()
        labels = np.squeeze(labels.reshape(-1, 1)).tolist()
        self.preds.append(preds)
        self.labels.append(labels)
def update ( self , preds_and_labels ) : preds = preds_and_labels [ 0 ] labels = preds_and_labels [ 1 ] if isinstance ( preds , paddle . Tensor ) : preds = preds . numpy ( ) if isinstance ( labels , paddle . Tensor ) : labels = labels . numpy ( ) preds = np . squeeze ( preds . reshape ( - 1 , 1 ) ) . tolist ( ) labels = np . squeeze ( labels . reshape ( - 1 , 1 ) ) . tolist ( ) self . preds . append ( preds ) self . labels . append ( labels )
Ensures the type of preds and labels is numpy.ndarray and reshapes them
into [-1, 1].
Ensures the type of preds and labels is numpy . ndarray and reshapes them into [ - 1 1 ] .
"""
        Ensures the type of preds and labels is numpy.ndarray and reshapes them
        into [-1, 1].

        Args:
            preds_and_labels (tuple[Tensor] or list[Tensor]):
                Tuple or list of predicted value and the ground truth label.
                Its data type should be float32 or float64 and its shape is [batch_size, d0, ..., dN].

        """
self
preds_and_labels
Tuple or list of predicted value and the ground truth label.
Its data type should be float32 or float64 and its shape is [batch_size, d0, ..., dN].
Tuple or list of predicted value and the ground truth label . Its data type should be float32 or float64 and its shape is [ batch_size d0 ... dN ] .