ASG icon indicating copy to clipboard operation
ASG copied to clipboard

TypeError: argument of type 'Tensor' is not iterable

Open RamyaRaghuraman opened this issue 5 years ago • 4 comments

Hi @eyounx ,

I get the following error when I run main.py: `C:\Users\RAR7ABT\AppData\Local\conda\conda\envs\test\python.exe C:/Users/RAR7ABT/pj-val-ml/pjval_ml/OSR/ASG/run.py Could not import RBDataSequenceDataset Traceback (most recent call last): File "C:/Users/RAR7ABT/pj-val-ml/pjval_ml/OSR/ASG/run.py", line 56, in Start filter data by category! data_by_label = cf.Filter() File "C:\Users\RAR7ABT\pj-val-ml\pjval_ml\OSR\ASG\class_filter.py", line 42, in Filter if data_by_label in idx_label: TypeError: argument of type 'Tensor' is not iterable

Process finished with exit code 1

` It might be a version compatibility issue. Any help would be appreciated. Thank you!

RamyaRaghuraman avatar Aug 09 '19 08:08 RamyaRaghuraman

In this case, the tensor vector cannot be recognized by the python iterator. You can try to convert 'idx_label' to list or numpy array types. I hope this will help you.

nogod1995 avatar Aug 10 '19 07:08 nogod1995

Converting the tensor to list or array did not help. Did you face this issue as well?

RamyaRaghuraman avatar Aug 19 '19 07:08 RamyaRaghuraman

Converting the tensor to list or array did not help. Did you face this issue as well?

Not quite sure what caused the issue. Could you run the demo file correctly?

eyounx avatar Sep 02 '19 08:09 eyounx

I initially got this error:

Start filter data by category! File "C:/Users/RAR7ABT/pj-val-ml/pjval_ml/OSR/ASG/run.py", line 72, in data_by_label = cf.Filter() File "C:\Users\RAR7ABT\pj-val-ml\pjval_ml\OSR\ASG\class_filter.py", line 43, in Filter if data_by_label.has_key(idx_label): AttributeError: 'dict' object has no attribute 'has_key'

Then I changed " if data_by_label.has_key(idx_label): data_by_label[idx_label].append(idx_data)" to " if data_by_label in idx_label: data_by_label[idx_label.item()].append(idx_data)"

So now I end up with "TypeError: argument of type 'numpy.int64' is not iterable"

RamyaRaghuraman avatar Sep 04 '19 12:09 RamyaRaghuraman