code: def analyzeWeightDistribution(weights,base):
    
    weights = weights.numpy()
    weights = weights.reshape(28*28*500)
    bins = np.linspace(-0.1, 0.1, 50)
    nz = weights.nonzero()[0]
    nzw = weights[nz]
    print("zero before and after:", (weights==0).sum(), (nzw==0).sum())
    print("Small weights:", (abs(nzw)>0.0).sum(), (abs(nzw)<0.01).sum(), (abs(nzw)<0.02).sum(), (abs(nzw)<0.03).sum())
    plt.hist(nzw, bins, alpha=0.5, label='All cols')
    plt.legend(loc='upper right')
    plt.xlabel("Weight values")
    plt.ylabel("Frequency")
    plt.title("Histogram of non-zero weight values")
    plt.savefig(base+"_weights")
    plt.close()
docs: Plot histogram of non-zero weight values.