learning.moments#
- bartorch.learning.moments()#
Mean and variance of a randomized reconstruction, voxel by voxel.
reconstructis calledsamplestimes without gradient, and each result is folded into running moments (Welford’s update), so memory holds the mean, the sum of squares and one result whateversamplesis. The spread measures whatever randomness the reconstruction draws: the patch grid of aPatchwisenetwork withshift=True, dropout left active in a network, or the acquired samples a reconstruction from asplit()of them keeps. Each is a distinct and partial measure of the error, and none is a posterior;calibrate()relates the spread to the error actually made on references.- Parameters:
reconstruct (callable) – Called with no argument; returns the reconstructed image, complex or real, the same shape every time.
samples (int, default=8) – Number of reconstructions.
- Returns:
mean, variance – On the device and with the shape of a reconstruction; the variance is real,
E|x - mean|^2with the unbiasedsamples - 1divisor.- Return type:
torch.Tensor