Optimization, Pytorch, Machine Learning, Deep Learning, Tensorboard.
target, weight): with torch.profiler.record_function('range'): r = torch.arange(target.shape[0], device="cuda:0") with torch.profiler.record_function('index'): nll = -pred[r, target] with torch.profiler.record_function('nll_calc'): nll = nll * weight[target] nll = nll/ weight[target].sum() sum_nll