Skip to content

Commit

Permalink
add mmap option
Browse files Browse the repository at this point in the history
It will be handy when debug or memory is limited
  • Loading branch information
lshiwjx authored May 22, 2018
1 parent d245bd1 commit e102534
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions st_gcn/feeder/feeder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def __init__(self,
random_move=False,
window_size=-1,
normalization=False,
debug=False):
debug=False,
mmap=False):
self.debug = debug
self.data_path = data_path
self.label_path = label_path
Expand Down Expand Up @@ -75,8 +76,11 @@ def load_data(self):
raise ValueError()

# load data
self.data = np.load(self.data_path, mmap_mode='r')

if mmap:
self.data = np.load(self.data_path, mmap_mode='r')
else:
self.data = np.load(self.data_path)

if self.debug:
self.label = self.label[0:100]
self.data = self.data[0:100]
Expand Down

0 comments on commit e102534

Please sign in to comment.