Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ljk628 committed Oct 22, 2018
1 parent 02827f3 commit 72ea026
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions h5_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@
import torch

def write_list(f, name, direction):
"""Write a list of numpy arrays into the hdf5 file"""
""" Save the direction to the hdf5 file with name as the key
Args:
f: h5py file object
name: key name_surface_file
direction: a list of tensors
"""

grp = f.create_group(name)
for i, l in enumerate(direction):
if isinstance(l, torch.Tensor):
Expand All @@ -14,6 +21,6 @@ def write_list(f, name, direction):


def read_list(f, name):
"""Read a list of numpy arrays from the hdf5 file"""
""" Read group with name as the key from the hdf5 file and return a list numpy vectors. """
grp = f[name]
return [grp[str(i)] for i in range(len(grp))]

0 comments on commit 72ea026

Please sign in to comment.