param_size = hv.size()
if len(param_size) <= 2: # for 0/1/2D tensor
# Hessian diagonal block size is 1 here.
# We use that torch.abs(hv * vi) = hv.abs()
tmp_output = hv.abs()
elif len(param_size) == 4: # Conv kernel
# Hessian diagonal block size is 9 here: torch.sum() reduces
# the dim 2/3.
# We use that torch.abs(hv * vi) = hv.abs()
tmp_output = torch.mean(hv.abs(), dim=[2, 3], keepdim=True)
hutchinson_trace.append(tmp_output)
this resutls in an error:
python3.10/site-packages/torch_optimizer/adahessian.py", line 128, in get_trace
hutchinson_trace.append(tmp_output)
UnboundLocalError: local variable 'tmp_output' referenced before assignment
this resutls in an error: