Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added batch iteration into input and target variables (#285) #288

Merged
merged 5 commits into from
Sep 21, 2018

Conversation

keitakurita
Copy link
Contributor

Now, the batch can be iterated into input and target variables like

>>> (x1, x2, x3), y = batch

where x1 to x3 are inputs to a downstream model and y is the label data for this batch.

Copy link
Contributor

@mttk mttk left a comment

Choose a reason for hiding this comment

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

LGTM, just add a few brief comments when you manage and I'm merging this

@@ -58,6 +62,20 @@ def __str__(self):
def __len__(self):
return self.batch_size

def _get_vars(self, target):

This comment was marked as off-topic.

def _get_vars(self, target):
fields = self.target_fields if target else self.input_fields
vars = tuple(getattr(self, f) for f in fields)
if len(vars) == 0:

This comment was marked as off-topic.

@keitakurita
Copy link
Contributor Author

Hi, thanks for the review! I changed the code to reflect my intent more clearly, I think this should resolve the above problems, but if anything can be improved please tell me :)

@mttk
Copy link
Contributor

mttk commented Sep 21, 2018

Awesome, thanks, everything seems good now!

@mttk mttk merged commit fa0abff into pytorch:master Sep 21, 2018
@raheelqader raheelqader mentioned this pull request Oct 8, 2018
@SudoSharma
Copy link
Contributor

SudoSharma commented Oct 18, 2018

Hey everyone, I ran into the same issue as @raheelqader in issue 422, with the "is_target" attribute being referenced for a "RawField" instance. I'd like to suggest we add an "is_target" attribute to "RawField" and set it to False by default.

I'd like to contribute, but this is my first time. Should I just go ahead and do a PR once I've made the fix? Thanks! Looking forward to contributing.

@mttk
Copy link
Contributor

mttk commented Oct 19, 2018

Hey, sure, feel free to submit a PR!

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.

None yet

3 participants