Here is the complete stack trace:

Traceback (most recent call last):
File “”, line 1, in 
runfile(‘C:/Users/Peter/Desktop/JMP/Analysis/Original estimation 3-22-19/estimations_new2.py’, wdir=‘C:/Users/Peter/Desktop/JMP/Analysis/Original estimation 3-22-19’)
File “C:\Users\Peter\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 827, in runfile
execfile(filename, namespace)
File “C:\Users\Peter\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py”, line 110, in execfile
exec(compile(f.read(), filename, ‘exec’), namespace)
File “C:/Users/Peter/Desktop/JMP/Analysis/Original estimation 3-22-19/estimations_new2.py”, line 198, in 
take_step=take_step, minimizer_kwargs=arg)
File “C:\Users\Peter\Anaconda3\lib\site-packages\scipy\optimize_basinhopping.py”, line 669, in basinhopping
accept_tests, disp=disp)
File “C:\Users\Peter\Anaconda3\lib\site-packages\scipy\optimize_basinhopping.py”, line 74, in init
minres = minimizer(self.x)
File “C:\Users\Peter\Anaconda3\lib\site-packages\scipy\optimize_basinhopping.py”, line 286, in call
return self.minimizer(self.func, x0, **self.kwargs)
File “C:\Users\Peter\Anaconda3\lib\site-packages\scipy\optimize_minimize.py”, line 618, in minimize
constraints, callback=callback, **options)
File “C:\Users\Peter\Anaconda3\lib\site-packages\scipy\optimize\slsqp.py”, line 399, in _minimize_slsqp
fx = func(x)
File “C:\Users\Peter\Anaconda3\lib\site-packages\scipy\optimize\optimize.py”, line 327, in function_wrapper
return function(*(wrapper_args + args))
File “C:\Users\Peter\Anaconda3\lib\site-packages\scipy\optimize\optimize.py”, line 65, in call
fg = self.fun(x, *args)
File “C:\Users\Peter\Desktop\JMP\Analysis\Original estimation 3-22-19\myLib_new2.py”, line 115, in fun
ll.backward()
File “C:\Users\Peter\AppData\Roaming\Python\Python37\site-packages\torch\tensor.py”, line 198, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File “C:\Users\Peter\AppData\Roaming\Python\Python37\site-packages\torch\autograd_init_.py”, line 100, in backward
allow_unreachable=True)  # allow_unreachable flag
RuntimeError: The size of tensor a (28000) must match the size of tensor b (56000) at non-singleton dimension 0