algos/models/algorithm_base.py
def calculate_step_acc(output, output_real, batch_mask, take_total_for_classes=True):
        """ Calculates the accuracy for a givens step """
        output = output.squeeze(-1)
        correct = 0
        tot = 0
        correct = output == output_real
        if len(correct.shape) == 2 and take_total_for_classes:
            correct = correct.float().mean(dim=-1)
        _, batch_mask = torch.unique(batch_mask, return_inverse=True)
        correct_per_batch = torch_scatter.scatter(correct.float(), batch_mask, reduce='mean', dim=0)
        return correct_per_batch
 Calculates the accuracy for a givens step 
Calculates the accuracy for a givens step
Calculates the accuracy for a givens step
def calculate_step_acc(output, output_real, batch_mask, take_total_for_classes=True):
        output = output.squeeze(-1)
        correct = 0
        tot = 0
        correct = output == output_real
        if len(correct.shape) == 2 and take_total_for_classes:
            correct = correct.float().mean(dim=-1)
        _, batch_mask = torch.unique(batch_mask, return_inverse=True)
        correct_per_batch = torch_scatter.scatter(correct.float(), batch_mask, reduce='mean', dim=0)
        return correct_per_batch
def calculate_step_acc ( output , output_real , batch_mask , take_total_for_classes = True ) : output = output . squeeze ( - 1 ) correct = 0 tot = 0 correct = output == output_real if len ( correct . shape ) == 2 and take_total_for_classes : correct = correct . float ( ) . mean ( dim = - 1 ) _ , batch_mask = torch . unique ( batch_mask , return_inverse = True ) correct_per_batch = torch_scatter . scatter ( correct . float ( ) , batch_mask , reduce = 'mean' , dim = 0 ) return correct_per_batch
Calculates the accuracy for a givens step
Calculates the accuracy for a givens step
""" Calculates the accuracy for a givens step """
output
output_real
batch_mask
take_total_for_classes