Skip to content

Conversation

@zsdonghao
Copy link
Member

This API works well for numpy array input, but when inputs are list, and we shuffle the data, we can't index the elements in a list with a list.

@zsdonghao zsdonghao requested a review from lgarithm April 8, 2018 04:12
else:
excerpt = slice(start_idx, start_idx + batch_size)
yield inputs[excerpt], targets[excerpt]
if (isinstance(inputs, list) or isinstance(targets, list)) and (shuffle == True):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it still work if isinstance(inputs, list) == True but isinstance(targets, list) == False?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, it doesn't, list can't be indexed by a list of ID.

Copy link
Member

@luomai luomai Apr 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inputs = [inputs[i] for i in excerpt] if isinstance(inputs, list) else inputs[excerpt]
targets = [targets[i] for i in excerpt] if isinstance(targets, list)) else targets[excerpt]
yield inputs, targets

@zsdonghao zsdonghao requested review from luomai and wagamamaz April 8, 2018 14:21
@zsdonghao zsdonghao merged commit 09a739d into master Apr 10, 2018
@zsdonghao zsdonghao deleted the iterator branch April 10, 2018 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants