HI there,
I think I got the code right but I keep getting the error as below. Please help me.
IndexError Traceback (most recent call last)
File /opt/conda/lib/python3.8/site-packages/jax/core.py:1427, in ShapedArray._len(self, ignored_tracer)
1426 try:
→ 1427 return self.shape[0]
1428 except IndexError as err:
IndexError: tuple index out of range
The above exception was the direct cause of the following exception:
TypeError Traceback (most recent call last)
Cell In [41], line 14
10 ### END CODE HERE ###
12 return dLdOmega_array
—> 14 dLdOmega_array = dLdOmega_of_omega_array(omega_array, prices_A, prices_B)
Cell In [41], line 8, in dLdOmega_of_omega_array(omega_array, pA, pB)
4 dLdOmega_array = np.zeros(N)
6 for i in range(N):
7 ### START CODE HERE ### (~ 2 lines of code)
----> 8 dLdOmega = grad(L_of_omega_array)(omega_array[i], pA, pB)
9 dLdOmega_array = dLdOmega_array.at[i].set(dLdOmega)
10 ### END CODE HERE ###
[... skipping hidden 10 frame]
Cell In [36], line 8, in L_of_omega_array(omega_array, pA, pB)
7 def L_of_omega_array(omega_array, pA, pB):
----> 8 N = len(omega_array)
9 L_array = np.zeros(N)
11 for i in range(N):
12 ### START CODE HERE ### (~ 2 lines of code)
[... skipping hidden 1 frame]
File /opt/conda/lib/python3.8/site-packages/jax/core.py:1429, in ShapedArray._len(self, ignored_tracer)
1427 return self.shape[0]
1428 except IndexError as err:
→ 1429 raise TypeError(“len() of unsized object”) from err
TypeError: len() of unsized object