Commit 15c0e160 authored by Yuxin Wu's avatar Yuxin Wu

Handle "long" type in Python 2 (#737)

parent a2c36b3d
......@@ -7,8 +7,8 @@ __Training__ code of three variants of ResNet on ImageNet:
* [Pre-activation ResNet](https://arxiv.org/abs/1603.05027)
* [Squeeze-and-Excitation ResNet](https://arxiv.org/abs/1709.01507)
The training mostly follows the setup in [fb.resnet.torch](https://github.com/facebook/fb.resnet.torch)
and gets similar performance (with much fewer lines of code).
The training follows the __exact__ recipe used by the [Training ImageNet in 1 Hour paper](https://arxiv.org/abs/1706.02677)
and gets the same performance.
Models can be [downloaded here](http://models.tensorpack.com/ResNet/).
| Model | Top 5 Error | Top 1 Error |
......
......@@ -3,6 +3,7 @@
from __future__ import division
import six
import numpy as np
from copy import copy
import pprint
......@@ -131,7 +132,7 @@ class BatchData(ProxyDataFlow):
[x[k] for x in data_holder])
else:
dt = data_holder[0][k]
if type(dt) in [int, bool]:
if type(dt) in list(six.integer_types) + [bool]:
tp = 'int32'
elif type(dt) == float:
tp = 'float32'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment