dtype = np.float16 cpu = 1 repeat = 1 ng = NervanaGPU(stochastic_round=False, bench=True) pool = ng.pool_layer( "max", 64, # N 64, 1, 64, 64, # C,D,H,W 4, 1, 2, 2, # J,T,R,S 0, 0, 0, 0, # padding 4, 1, 2, 2) # strides dimI = pool.dimI dimO = pool.dimO # colapse pooling dimensions into one
dtype = np.float32 cpu = 1 repeat = 1 ng = NervanaGPU(stochastic_round=False, bench=True) pool = ng.pool_layer( dtype, "max", 32, # N 32, 1, 32, 32, # C,D,H,W 2, 1, 3, 3, # J,T,R,S 0, 0, 0, 0, # padding 2, 1, 2, 2) # strides dimI = pool.dimI dimO = pool.dimO # colapse pooling dimensions into one
from operator import mul print context.get_device().name() np.set_printoptions(threshold=8193, linewidth=600, formatter={'int':lambda x: "%10d" % x,'float':lambda x: "% .3f" % x}) dtype = np.float16 cpu = 1 repeat = 1 ng = NervanaGPU(stochastic_round=False, bench=True) pool = ng.pool_layer( "max", 64, # N 64,1,64,64, # C,D,H,W 4,1,2,2, # J,T,R,S 0,0,0,0, # padding 4,1,2,2) # strides dimI = pool.dimI dimO = pool.dimO # colapse pooling dimensions into one # this allows for easy cpu pooling in numpy def slicable(dim, pad=0): dim0 = reduce(mul, dim[:-1], 1) + pad return (dim0, dim[-1]) # cpu input arrays cpuI = np.random.uniform(0.0, 9.4, slicable(dimI,1)).astype(np.float16).astype(np.float32)
from operator import mul print(context.get_device().name()) np.set_printoptions(threshold=8193, linewidth=600, formatter={'int':lambda x: "%10d" % x,'float':lambda x: "% .3f" % x}) dtype = np.float32 cpu = 1 repeat = 1 ng = NervanaGPU(stochastic_round=False, bench=True) pool = ng.pool_layer(dtype, "max", 32, # N 32,1,32,32, # C,D,H,W 2,1,3,3, # J,T,R,S 0,0,0,0, # padding 2,1,2,2) # strides dimI = pool.dimI dimO = pool.dimO # colapse pooling dimensions into one # this allows for easy cpu pooling in numpy def slicable(dim, pad=0): dim0 = reduce(mul, dim[:-1], 1) + pad return (dim0, dim[-1]) # cpu input arrays cpuI = np.random.uniform(0.0, 1.0, slicable(dimI,1)).astype(np.float16).astype(np.float32)