sega_learn.neural_networks.loss_cupy

 
Modules
       
cupy

 
Classes
       
builtins.object
CuPyBCEWithLogitsLoss
CuPyCrossEntropyLoss

 
class CuPyBCEWithLogitsLoss(builtins.object)
    Optimized binary cross entropy loss with logits implementation using cupy.
 
Formula: -mean(y * log(sigmoid(x)) + (1 - y) * log(1 - sigmoid(x)))
 
Methods:
    __call__(self, logits, targets): Calculate the binary cross entropy loss.
 
  Methods defined here:
__call__(self, logits, targets)
Calculate the binary cross entropy loss.
 
Args:
    logits (cp.ndarray): The logits (predicted values) of shape (num_samples,).
    targets (cp.ndarray): The target labels of shape (num_samples,).
 
Returns:
    float: The binary cross entropy loss.

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object

 
class CuPyCrossEntropyLoss(builtins.object)
    Optimized cross entropy loss implementation using cupy for multi-class classification.
 
Formula: -sum(y * log(p)) / m
Methods:
    __call__(self, logits, targets): Calculate the cross entropy loss.
 
  Methods defined here:
__call__(self, logits, targets)
Calculate the cross entropy loss.
 
Args:
    logits (cp.ndarray): The logits (predicted values) of shape (num_samples, num_classes).
    targets (cp.ndarray): The target labels of shape (num_samples, num_classes) or (num_samples,).
 
Returns:
    float: The cross entropy loss.

Data descriptors defined here:
__dict__
dictionary for instance variables
__weakref__
list of weak references to the object