Monitor PearsonCorrCoef in SaveModelCallback

I am new in fastai. I wanted to monitor PearsonCorrCoef or a ratio of PearsonCorrCoef and mae. I call this ratio best. It did not work with PearsonCorrCoef function.

I added two function to the metrics.py (attached bellow) and indexed them. Now it works for me.
I don’t have enough knowledge to understand why PearsonCorrCoef did not work with monitoring.

def pearson2(inp,targ):
inp, targ = flatten_check(inp, targ)
y = scs.pearsonr(inp, targ).statistic
return y

def best(inp,targ):
inp,targ = flatten_check(inp,targ)
mae = torch.abs(inp - targ).mean()
y = scs.pearsonr(inp,targ).statistic
value = y/mae
return value