mirror of
https://github.com/yunjey/pytorch-tutorial.git
synced 2025-07-13 07:14:48 +08:00
Removed unused code
This commit is contained in:
@ -19,8 +19,6 @@ class Dictionary(object):
|
|||||||
class Corpus(object):
|
class Corpus(object):
|
||||||
def __init__(self, path='./data'):
|
def __init__(self, path='./data'):
|
||||||
self.dictionary = Dictionary()
|
self.dictionary = Dictionary()
|
||||||
self.train = os.path.join(path, 'train.txt')
|
|
||||||
self.test = os.path.join(path, 'test.txt')
|
|
||||||
|
|
||||||
def get_data(self, path, batch_size=20):
|
def get_data(self, path, batch_size=20):
|
||||||
# Add words to the dictionary
|
# Add words to the dictionary
|
||||||
@ -43,4 +41,4 @@ class Corpus(object):
|
|||||||
token += 1
|
token += 1
|
||||||
num_batches = ids.size(0) // batch_size
|
num_batches = ids.size(0) // batch_size
|
||||||
ids = ids[:num_batches*batch_size]
|
ids = ids[:num_batches*batch_size]
|
||||||
return ids.view(batch_size, -1)
|
return ids.view(batch_size, -1)
|
||||||
|
Reference in New Issue
Block a user