Discussion:
[theano-users] TypeError: 'KeysView' object does not support indexing
Vinay Rajpoot
2018-03-22 20:32:34 UTC
Permalink
i am working on project and occuring this traceback can anybody suggest me
what changes should i make in below section of code
for index in indices:
key = dataset_keys[index]
data_x = dataset[key]['features'][...].astype(_DTYPE)
L_distance_mat = cdist(data_x, data_x, 'euclidean')
L_dissim_mat = 1 - np.dot(data_x, data_x.T)

Traceback (most recent call last):
File "vsum_train.py", line 155, in <module>
train_dataset_path=args.dataset)
File "vsum_train.py", line 83, in train
key = dataset_keys[index]
TypeError: 'KeysView' object does not support indexing
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Pascal Lamblin
2018-03-22 21:08:14 UTC
Permalink
It does not seem to have anything to do with Theano, but in Python3,
`dataset.keys()` would return a KeysView object, instead of a list like
in Python2.
That may be the reason.
Post by Vinay Rajpoot
i am working on project and occuring this traceback can anybody suggest
me what changes should i make in below section of code
            key = dataset_keys[index]
            data_x = dataset[key]['features'][...].astype(_DTYPE)
            L_distance_mat = cdist(data_x, data_x, 'euclidean')
            L_dissim_mat = 1 - np.dot(data_x, data_x.T)
  File "vsum_train.py", line 155, in <module>
    train_dataset_path=args.dataset)
  File "vsum_train.py", line 83, in train
    key = dataset_keys[index]
TypeError: 'KeysView' object does not support indexing
--
---
You received this message because you are subscribed to the Google
Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
Pascal Lamblin
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Vinay Rajpoot
2018-03-23 06:16:52 UTC
Permalink
Thanx, I have solved it by using python 2
Post by Pascal Lamblin
It does not seem to have anything to do with Theano, but in Python3,
`dataset.keys()` would return a KeysView object, instead of a list like in
Python2.
That may be the reason.
Post by Vinay Rajpoot
i am working on project and occuring this traceback can anybody suggest
me what changes should i make in below section of code
key = dataset_keys[index]
data_x = dataset[key]['features'][...].astype(_DTYPE)
L_distance_mat = cdist(data_x, data_x, 'euclidean')
L_dissim_mat = 1 - np.dot(data_x, data_x.T)
File "vsum_train.py", line 155, in <module>
train_dataset_path=args.dataset)
File "vsum_train.py", line 83, in train
key = dataset_keys[index]
TypeError: 'KeysView' object does not support indexing
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Pascal Lamblin
--
--- You received this message because you are subscribed to a topic in the
Google Groups "theano-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/to
pic/theano-users/MB7wkuWkPBI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to theano-users+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...