Skip to content

Commit

Permalink
Fix file reading issue for python3 code
Browse files Browse the repository at this point in the history
  • Loading branch information
andrefaraujo committed Feb 5, 2018
1 parent 7269932 commit 0d7ce10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions research/delf/delf/python/datum_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

"""Python interface for DatumProto.
DatumProto is protocol buffer used to serialize tensor with arbitrary shape.
Expand Down Expand Up @@ -93,7 +92,7 @@ def ReadFromFile(file_path):
Returns:
data: Numpy array.
"""
with tf.gfile.FastGFile(file_path, 'r') as f:
with tf.gfile.FastGFile(file_path, 'rb') as f:
return ParseFromString(f.read())


Expand Down
3 changes: 1 addition & 2 deletions research/delf/delf/python/feature_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

"""Python interface for DelfFeatures proto.
Support read and write of DelfFeatures from/to numpy arrays and file.
Expand Down Expand Up @@ -168,7 +167,7 @@ def ReadFromFile(file_path):
attention: [N] float array with attention scores.
orientations: [N] float array with orientations.
"""
with tf.gfile.FastGFile(file_path, 'r') as f:
with tf.gfile.FastGFile(file_path, 'rb') as f:
return ParseFromString(f.read())


Expand Down

0 comments on commit 0d7ce10

Please sign in to comment.