paddlenlp/metrics/glue.py
def compute(self, pred, label, *args):
        """
        Accepts network's output and the labels, and calculates the top-k
        (maximum value in topk) indices for accuracy.

        Args:
            pred (Tensor):
                Predicted tensor, and its dtype is float32 or float64, and
                has a shape of [batch_size, num_classes].
            label (Tensor):
                The ground truth tensor, and its dtype is is int64, and has a
                shape of [batch_size, 1] or [batch_size, num_classes] in one
                hot representation.

        Returns:
            Tensor: Correct mask, each element indicates whether the prediction
            equals to the label. Its' a tensor with a data type of float32 and
            has a shape of [batch_size, topk].

        """
        self.label = label
        self.preds_pos = paddle.nn.functional.softmax(pred)[:, self.pos_label]
        return self.acc.compute(pred, label)

        Accepts network's output and the labels, and calculates the top-k
        (maximum value in topk) indices for accuracy.

        Args:
            pred (Tensor):
                Predicted tensor, and its dtype is float32 or float64, and
                has a shape of [batch_size, num_classes].
            label (Tensor):
                The ground truth tensor, and its dtype is is int64, and has a
                shape of [batch_size, 1] or [batch_size, num_classes] in one
                hot representation.

        Returns:
            Tensor: Correct mask, each element indicates whether the prediction
            equals to the label. Its' a tensor with a data type of float32 and
            has a shape of [batch_size, topk].

        
Accepts network's output and the labels, and calculates the top-k
(maximum value in topk) indices for accuracy.
Accepts network ' s output and the labels and calculates the top - k ( maximum value in topk ) indices for accuracy .
def compute(self, pred, label, *args):
        self.label = label
        self.preds_pos = paddle.nn.functional.softmax(pred)[:, self.pos_label]
        return self.acc.compute(pred, label)
def compute ( self , pred , label , * args ) : self . label = label self . preds_pos = paddle . nn . functional . softmax ( pred ) [ : , self . pos_label ] return self . acc . compute ( pred , label )
Accepts network's output and the labels, and calculates the top-k
(maximum value in topk) indices for accuracy.
Accepts network ' s output and the labels and calculates the top - k ( maximum value in topk ) indices for accuracy .
"""
        Accepts network's output and the labels, and calculates the top-k
        (maximum value in topk) indices for accuracy.

        Args:
            pred (Tensor):
                Predicted tensor, and its dtype is float32 or float64, and
                has a shape of [batch_size, num_classes].
            label (Tensor):
                The ground truth tensor, and its dtype is is int64, and has a
                shape of [batch_size, 1] or [batch_size, num_classes] in one
                hot representation.

        Returns:
            Tensor: Correct mask, each element indicates whether the prediction
            equals to the label. Its' a tensor with a data type of float32 and
            has a shape of [batch_size, topk].

        """
Correct mask, each element indicates whether the prediction
equals to the label. Its' a tensor with a data type of float32 and
has a shape of [batch_size, topk].
Correct mask each element indicates whether the prediction equals to the label . Its ' a tensor with a data type of float32 and has a shape of [ batch_size topk ] .
Tensor
self
pred
Predicted tensor, and its dtype is float32 or float64, and
has a shape of [batch_size, num_classes].
Predicted tensor and its dtype is float32 or float64 and has a shape of [ batch_size num_classes ] .
label
The ground truth tensor, and its dtype is is int64, and has a
shape of [batch_size, 1] or [batch_size, num_classes] in one
hot representation.
The ground truth tensor and its dtype is is int64 and has a shape of [ batch_size 1 ] or [ batch_size num_classes ] in one hot representation .