Belle II Software light-2406-ragdoll
TCCE Class Reference
Inheritance diagram for TCCE:
Collaboration diagram for TCCE:

Public Member Functions

def __init__ (self, int n=0)
 
torch.tensor forward (self, torch.tensor y, torch.LongTensor y_true)
 

Public Attributes

 n
 Number of Taylor terms.
 

Detailed Description

Class for calculation of Taylor cross entropy loss.

Attributes:
    n (int): Number of Taylor series terms to be used for loss calculation.

Definition at line 45 of file torch_tcce.py.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
int   n = 0 
)
Initialize the loss class.

Parameters:
    n (int)(optional): Number of Taylor series terms to be used for loss calculation.

Definition at line 54 of file torch_tcce.py.

54 def __init__(self, n: int = 0):
55 """
56 Initialize the loss class.
57
58 Parameters:
59 n (int)(optional): Number of Taylor series terms to be used for loss calculation.
60
61 """
62 super().__init__()
63
64 self.n = n
65

Member Function Documentation

◆ forward()

torch.tensor forward (   self,
torch.tensor  y,
torch.LongTensor  y_true 
)
Calculates the Taylor categorical cross entropy loss.

Parameters:
    y(torch.tensor): Tensor containing the output of the model.
    y_true(torch.tensor): 1D tensor containing the truth value for a given set of features.

Returns:
    The calculated loss as a torch tensor.

Definition at line 66 of file torch_tcce.py.

66 def forward(self, y: torch.tensor, y_true: torch.LongTensor) -> torch.tensor:
67 """
68 Calculates the Taylor categorical cross entropy loss.
69
70 Parameters:
71 y(torch.tensor): Tensor containing the output of the model.
72 y_true(torch.tensor): 1D tensor containing the truth value for a given set of features.
73
74 Returns:
75 The calculated loss as a torch tensor.
76 """
77 return tcc(y, y_true, self.n)

Member Data Documentation

◆ n

n

Number of Taylor terms.

Definition at line 64 of file torch_tcce.py.


The documentation for this class was generated from the following file: