- losses = (-output.log_softmax(-1) * targets + targets.xlogy(targets)).sum(-1)
- losses = losses / losses.max()
- print(f"{input.size()=} {losses.size()=} {losses.min()=} {losses.max()=}")
- losses = losses * (input == 0)
+ # losses = (-output.log_softmax(-1) * targets + targets.xlogy(targets)).sum(-1)
+ # losses = losses * (input == maze.v_empty)
+ # losses = losses / losses.max()
+ # losses = (output.softmax(-1) - targets).abs().max(-1).values
+ # losses = (losses >= 0.05).float()
+ losses = (
+ (F.one_hot(output.argmax(-1), num_classes=4) * targets).sum(-1) == 0
+ ).float()