libmultilabel/model.py
def shared_step(self, batch):
        """Return loss and predicted logits of the network.

        Args:
            batch (dict): A batch of text and label.

        Returns:
            loss (Tensor): Binary cross-entropy between target and predict logits.
            pred_logits (Tensor): The predict logits (batch_size, num_classes).
        """
        target_labels = batch['label']
        outputs = self.network(batch['text'])
        pred_logits = outputs['logits']
        loss = F.binary_cross_entropy_with_logits(pred_logits, target_labels.float())
        return loss, pred_logits
Return loss and predicted logits of the network.

        Args:
            batch (dict): A batch of text and label.

        Returns:
            loss (Tensor): Binary cross-entropy between target and predict logits.
            pred_logits (Tensor): The predict logits (batch_size, num_classes).
        
Return loss and predicted logits of the network.
Return loss and predicted logits of the network .
def shared_step(self, batch):
        target_labels = batch['label']
        outputs = self.network(batch['text'])
        pred_logits = outputs['logits']
        loss = F.binary_cross_entropy_with_logits(pred_logits, target_labels.float())
        return loss, pred_logits
def shared_step ( self , batch ) : target_labels = batch [ 'label' ] outputs = self . network ( batch [ 'text' ] ) pred_logits = outputs [ 'logits' ] loss = F . binary_cross_entropy_with_logits ( pred_logits , target_labels . float ( ) ) return loss , pred_logits
Return loss and predicted logits of the network.
Return loss and predicted logits of the network .
"""Return loss and predicted logits of the network.

        Args:
            batch (dict): A batch of text and label.

        Returns:
            loss (Tensor): Binary cross-entropy between target and predict logits.
            pred_logits (Tensor): The predict logits (batch_size, num_classes).
        """
loss (Tensor): Binary cross-entropy between target and predict logits.
pred_logits (Tensor): The predict logits (batch_size, num_classes).
loss ( Tensor ) : Binary cross - entropy between target and predict logits . pred_logits ( Tensor ) : The predict logits ( batch_size num_classes ) .
self
batch
A batch of text and label.
A batch of text and label .