Good fellow friends,
I have built a deep unfolding network for signal detection, the model trains well but during inference over different signal-to-noise ration, I’m getting the following error:
def eval(network,t): #calculate BER
    snr_t = torch.linspace(0.0, 15.0, 6)
    sigma2_t = (N/torch.pow(10,snr_t/10.0))/2.0
    sigma_std_t = torch.sqrt(sigma2_t) 
    s_zero = torch.zeros(batch_size, N) #.cuda()  # initial value
    accuracy = torch.zeros(1, len(snr_t))
    num_err = torch.zeros(1, test_itr)
    H_change()
    for k in range(len(snr_t)):
        for i in range(test_itr):
            x = generate_batch() #.cuda()
            x_hat = network(x, s_zero, t+1, sigma_std_t[k]) #.cuda()
            if isnan(x_hat).any():
                print("Nan")
                continue

            err = x * torch.sign(x_hat)
            num_err[0][i] += torch.nonzero(F.relu(err)).size(0)

        accuracy[0][k] = torch.mean(num_err/(test_itr*batch_size*N))
        BER = 1 - accuracy
        print('({0}) BER:{1:6.6f}'.format(t + 1, BER))

    return BER

Below is the error it returns, please help me. Thank you
Traceback (most recent call last):
  File "/Users/mac/Desktop/OAMP_NET/tpg.py", line 243, in <module>
    main()
  File "/Users/mac/Desktop/OAMP_NET/tpg.py", line 193, in main
    BER = eval(network,t)
  File "/Users/mac/Desktop/OAMP_NET/tpg.py", line 149, in eval
    print('({0}) BER:{1:6.6f}'.format(t + 1, BER))
  File "/Users/mac/miniconda3/lib/python3.6/site-packages/torch/tensor.py", line 379, in __format__
    return object.__format__(self, format_spec)
TypeError: unsupported format string passed to Tensor.__format__