Skip to content

Commit

Permalink
Resolve #94 Incorrect dtype under Windows (#96)
Browse files Browse the repository at this point in the history
Change dtype of NumPy array created in `padded_batch` to `np.int64`.
Previously `padded_batch` creates a NumPy array of dtype `np.long`,
which is a platform-dependent type, which is equivalent to `int32`
under Windows.
  • Loading branch information
huzecong committed Jul 9, 2019
1 parent 5e899bf commit 908daa2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion texar/data/data/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def padded_batch(examples: Union[List[np.ndarray], List[List[int]]],
lengths = [len(sent) for sent in examples]
pad_length = pad_length or max(lengths)

padded = np.full((len(examples), pad_length), pad_value, dtype=np.long)
padded = np.full((len(examples), pad_length), pad_value, dtype=np.int64)
for b_idx, sent in enumerate(examples):
length = lengths[b_idx]
padded[b_idx, :length] = sent[:length]
Expand Down

0 comments on commit 908daa2

Please sign in to comment.