Skip to content

Commit

Permalink
set is_target to False by default in RawField (#459)
Browse files Browse the repository at this point in the history
- Fixes error with `RawField` in `Iterator`
  • Loading branch information
SudoSharma authored and mttk committed Oct 24, 2018
1 parent 98de87c commit 9187177
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion torchtext/data/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ class RawField(object):
using this field before assigning to a batch.
Function signature: (batch(list)) -> object
Default: None.
is_target: Whether this field is a target variable.
Affects iteration over batches. Default: False
"""

def __init__(self, preprocessing=None, postprocessing=None):
def __init__(self, preprocessing=None, postprocessing=None, is_target=False):
self.preprocessing = preprocessing
self.postprocessing = postprocessing
self.is_target = is_target

def preprocess(self, x):
""" Preprocess an example if the `preprocessing` Pipeline is provided. """
Expand Down

0 comments on commit 9187177

Please sign in to comment.