You could try to translate this code by using the torch
namespace.
E.g this might work (untested):
def earth_mover_distance(y_true, y_pred):
return torch.mean(torch.square(torch.cumsum(y_true, dim=-1) - torch.cumsum(y_pred, dim=-1)), dim=-1)
You could try to translate this code by using the torch
namespace.
E.g this might work (untested):
def earth_mover_distance(y_true, y_pred):
return torch.mean(torch.square(torch.cumsum(y_true, dim=-1) - torch.cumsum(y_pred, dim=-1)), dim=-1)