vfdev-5:

precision = Precision(output_transform=ot_map_labels)


Thank you. Just one more question . If I have this type of training
def update_fn(engine, batch):
    
    model.train()
    
    x = convert_tensor(batch[0], device=device, non_blocking=True)
    y = convert_tensor(batch[1], device=device, non_blocking=True)
    
    y_pred = model(x)
    
    # Compute loss 
    loss = criterion(y_pred, y)    

    optimizer.zero_grad()
    if use_amp:
        with amp.scale_loss(loss, optimizer, loss_id=0) as scaled_loss:
            scaled_loss.backward()
    else:
        loss.backward()
    optimizer.step()
    
    return {
        "batchloss": loss.item(),
    }    

Where should I call the function precision? and also I think the function ot_map_labels should return y_pred and new_y?
What I did is…

Define mapping
define function ot_map_labels
inside update_fn before loss I call precision function, but I didn’t work

Thanks for your help!