If you use it like:
def expw_mae_loss(output, target, base=10.0):
    base = Variable(torch.Tensor([base])).type_as(target)
    return(( (output - target).abs() * torch.pow(base, target) ).sum() / output.data.nelement() )

Then the gradients will flow as expected for output and target.
In you sample, I think you’re gonna get wrong gradients for target.