print"OPTIMISATION WARNING: in ConvOp.__init__() unroll_batch(%s) must be 0 or a multiple of bsize(%s). We revert it to 1. This won't change the result, but may make it slower."%(str(self.unroll_batch),str(self.bsize))
print"OPTIMISATION WARNING: in ConvOp.__init__() unroll_batch(%s) must be 0 or a multiple of bsize(%s). We revert it to 1. This won't change the result, but may make it slower."%(str(self.unroll_batch),str(self.bsize))
self.unroll_batch=1
ifself.unroll_kern>0andself.nkern%unroll_kern!=0:
ifself.unroll_kern>0andself.nkern%unroll_kern!=0:
ifself.nkern<self.unroll_kern:
ifself.nkern<=self.unroll_kern:
self.unroll_kern=self.nkern
self.unroll_kern=self.nkern
else:
else:
self.unroll_kern=1
print"OPTIMISATION WARNING: in ConvOp.__init__() unroll_kern(%s) should be 0 or a multiple of nkern(%s)We revert it to 1. This won't change the result, but may make it slower."%(str(self.unroll_kern),str(self.nkern))
print"OPTIMISATION WARNING: in ConvOp.__init__() unroll_kern(%s) should be 0 or a multiple of nkern(%s)We revert it to 1. This won't change the result, but may make it slower."%(str(self.unroll_kern),str(self.nkern))
self.unroll_kern=1
ifself.dx!=1orself.dy!=1:
ifself.dx!=1orself.dy!=1:
print"Warning, dx!=1 or dy!=1 only supported in python mode!"
print"Warning, dx!=1 or dy!=1 only supported in python mode!"
raiseNotImplementedError()
raiseNotImplementedError()
...
@@ -145,25 +145,27 @@ class ConvOp(Op):
...
@@ -145,25 +145,27 @@ class ConvOp(Op):
(bsize,nkern)=(self.imshp[0],self.nkern)
(bsize,nkern)=(self.imshp[0],self.nkern)
imshp=N.hstack((self.bsize,self.imshp[1:]))
imshp=N.hstack((self.bsize,self.imshp[1:]))
kshp=self.outshp
kshp=self.outshp
un_b=self.unroll_batch
un_k=self.unroll_kern
elifself.out_mode=='full':
elifself.out_mode=='full':
(img,filters)=(newgz,newin)
(img,filters)=(newgz,newin)
(bsize,nkern)=(self.nkern,self.imshp[0])
(bsize,nkern)=(self.nkern,self.imshp[0])
imshp=N.hstack((self.bsize,self.outshp))
imshp=N.hstack((self.bsize,self.outshp))
kshp=self.imshp[1:]
kshp=self.imshp[1:]
un_b=self.unroll_kern
un_k=self.unroll_batch
else:
else:
raiseNotImplementedError('Only [full,valid] modes are currently supported.')
raiseNotImplementedError('Only [full,valid] modes are currently supported.')
filters=filters[:,:,::-1,::-1]
filters=filters[:,:,::-1,::-1]
#find good value for the unroll
#find good value for the unroll
un_b=self.unroll_batch
un_k=self.unroll_kern
ifun_b!=0andbsize%un_b!=0:
ifun_b!=0andbsize%un_b!=0:
ifbsize<un_b:
ifbsize<un_b:
un_b=bsize
un_b=bsize
else:
else:
un_b=1
un_b=1
print"OPTIMISATION WARNING: in ConvOp.grad() we can't determine a good unroll value for the batch. Maybe you can optimize this!"
print"OPTIMISATION WARNING: in ConvOp.grad() we can't determine a good unroll value for the batch. Maybe you can optimize this!",bsize,un_b,self.unroll_batch,self.unroll_kern