提交 93ded46f authored 作者: Frederic Bastien's avatar Frederic Bastien

put a member imshp into GpuConv for another version of it that is in development.

上级 b7283974
...@@ -266,7 +266,8 @@ class GpuConv(Op): ...@@ -266,7 +266,8 @@ class GpuConv(Op):
logical_kern_align_top=True, logical_kern_align_top=True,
version=-1, version=-1,
verbose=0, verbose=0,
kshp=None): kshp=None,
imshp=None):
""" """
:param version: each version of c_code implement many kernel for the :param version: each version of c_code implement many kernel for the
convolution. By default we try to guess the best one. convolution. By default we try to guess the best one.
...@@ -278,6 +279,8 @@ class GpuConv(Op): ...@@ -278,6 +279,8 @@ class GpuConv(Op):
:param kshp: The size of the kernel. If provided, can genera :param kshp: The size of the kernel. If provided, can genera
faster code. If the GpuConv op is automatically inserted, faster code. If the GpuConv op is automatically inserted,
we take its value automatically from the Conv op. we take its value automatically from the Conv op.
:param imshp: The size of the image. Not used for code generation but
allow to select an experimental new version in another repo.
""" """
self.border_mode = border_mode self.border_mode = border_mode
self.subsample = subsample self.subsample = subsample
...@@ -299,6 +302,7 @@ class GpuConv(Op): ...@@ -299,6 +302,7 @@ class GpuConv(Op):
self.version=version self.version=version
self.verbose=verbose self.verbose=verbose
self.kshp = kshp self.kshp = kshp
self.imshp = imshp
def __eq__(self, other): def __eq__(self, other):
return type(self) == type(other) \ return type(self) == type(other) \
...@@ -309,7 +313,13 @@ class GpuConv(Op): ...@@ -309,7 +313,13 @@ class GpuConv(Op):
and self.logical_kern_align_top == other.logical_kern_align_top \ and self.logical_kern_align_top == other.logical_kern_align_top \
and self.version == other.version \ and self.version == other.version \
and self.verbose == other.verbose \ and self.verbose == other.verbose \
and self.kshp == other.kshp and self.kshp == other.kshp\
and self.imshp == other.imshp
def __setstate__(self, d):
self.__dict__.update(d)
if not hasattr(self,"imshp"):
self.imshp = None
def __hash__(self): def __hash__(self):
# don't use hash(self.version) as hash(-1)==-2 and hash(-2)==-2 in python! # don't use hash(self.version) as hash(-1)==-2 and hash(-2)==-2 in python!
...@@ -321,7 +331,8 @@ class GpuConv(Op): ...@@ -321,7 +331,8 @@ class GpuConv(Op):
^ hash(self.logical_kern_align_top) \ ^ hash(self.logical_kern_align_top) \
^ self.version \ ^ self.version \
^ hash(self.verbose) \ ^ hash(self.verbose) \
^ hash(self.kshp) ^ hash(self.kshp)\
^ hash(self.imshp)
def __str__(self): def __str__(self):
return '%s{%s, %s, %s, %s, %s}' %(self.__class__.__name__, return '%s{%s, %s, %s, %s, %s}' %(self.__class__.__name__,
......
...@@ -606,7 +606,8 @@ def local_gpu_conv(node): ...@@ -606,7 +606,8 @@ def local_gpu_conv(node):
logical_kern_align_top=op.kshp_logical_top_aligned, logical_kern_align_top=op.kshp_logical_top_aligned,
kshp=op.kshp, kshp=op.kshp,
version=op.version, version=op.version,
verbose=op.verbose verbose=op.verbose,
imshp=op.imshp,
) )
#HACK to print the number of MFlops in the profiler output. #HACK to print the number of MFlops in the profiler output.
if hasattr(op,'flops'): if hasattr(op,'flops'):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论