May I ask why "'type' object is not subscriptable" appears when running the code?
May I ask why "'type' object is not subscriptable" appears when running the code?
May I ask why "'type' object is not subscriptable" appears when running the code?
This is caused by python3.8 or previous versions, I wrote the code using python3.9. You can upgrade the python to 3.9.
Here is an example:
def func(li:list[str])->list[str]: # this will cause error in python 3.8 , but is right in 3.9
May I ask why "'type' object is not subscriptable" appears when running the code?
I have explained the cause of the error. The easiest way is to create a new python environment and install the dependencies under my repository.
run this command
conda create -n rl python=3.9
pip install -r requirements.txt
Or, you must modify all
def func(li:list[str])->list[str]:
to
def func(li):
I write the code in such a way that I can know what the type of each variable is. I hope my answer is helpful =-=.
thanks you. Can you give me an example? For example, "def sample(self) -> tuple[np.ndarray, t.ensor, t.ensor, t.ensor, t.ensor, t.ensor, t.ensor]: "What to change to
thanks you. Can you give me an example? For example, "def sample(self) -> tuple[np.ndarray, t.ensor, t.ensor, t.ensor, t.ensor, t.ensor, t.ensor]: "What to change to
Just delet all the return values!
def sample(self):