Skip to content

Commit

Permalink
python3 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ppwwyyxx committed Apr 24, 2016
1 parent 3f74330 commit b6a775f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
sys.path.insert(0, os.path.abspath('../'))

import mock
MOCK_MODULES = ['numpy', 'scipy', 'tensorflow', 'scipy.misc', 'h5py', 'nltk']
MOCK_MODULES = ['numpy', 'scipy', 'tensorflow', 'scipy.misc', 'h5py', 'nltk', 'cv2']
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = mock.Mock()

Expand Down
4 changes: 2 additions & 2 deletions tensorpack/callbacks/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import tensorflow as tf
from tqdm import tqdm
from abc import ABCMeta, abstractmethod
from six.moves import zip
from six.moves import zip, map

from ..dataflow import DataFlow
from ..utils import *
Expand Down Expand Up @@ -102,7 +102,7 @@ def find_oid(var):
def get_tensor(name):
_, varname = get_op_var_name(name)
return self.graph.get_tensor_by_name(varname)
self.output_tensors = map(get_tensor, self.output_tensors)
self.output_tensors = list(map(get_tensor, self.output_tensors))

def _trigger_epoch(self):
for vc in self.vcs:
Expand Down
5 changes: 3 additions & 2 deletions tensorpack/dataflow/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# File: common.py
# Author: Yuxin Wu <ppwwyyxx@gmail.com>

import numpy as np
from __future__ import division
import copy
import numpy as np
from six.moves import range
from .base import DataFlow, ProxyDataFlow
from ..utils import *
Expand All @@ -30,7 +31,7 @@ def __init__(self, ds, batch_size, remainder=False):

def size(self):
ds_size = self.ds.size()
div = ds_size / self.batch_size
div = ds_size // self.batch_size
rem = ds_size % self.batch_size
if rem == 0:
return div
Expand Down
2 changes: 1 addition & 1 deletion tensorpack/dataflow/dataset/visualqa.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_common_question_words(self, n):
vqa = VisualQA('/home/wyx/data/VQA/MultipleChoice_mscoco_train2014_questions.json',
'/home/wyx/data/VQA/mscoco_train2014_annotations.json')
for k in vqa.get_data():
print json.dumps(k)
print(json.dumps(k))
break
# vqa.get_common_question_words(100)
vqa.get_common_answer(100)
Expand Down

0 comments on commit b6a775f

Please sign in to comment.