提交 bbd9ff3f authored 作者: Harm de Vries's avatar Harm de Vries

flake8

上级 5c172018
...@@ -1530,8 +1530,8 @@ if (err != CUDNN_STATUS_SUCCESS) { ...@@ -1530,8 +1530,8 @@ if (err != CUDNN_STATUS_SUCCESS) {
""" % dict(out=out, fail=sub['fail'], """ % dict(out=out, fail=sub['fail'],
name=name, input=inputs[0], name=name, input=inputs[0],
ws=ws, pad=pad, str=stride, ws=ws, pad=pad, str=stride,
nd=node.inputs[0].ndim-2, input_desc="input"+name, nd=node.inputs[0].ndim - 2, input_desc="input" + name,
output_desc="output"+name, output_desc="output" + name,
mode_flag=mode_flag) mode_flag=mode_flag)
def grad(self, inp, grads): def grad(self, inp, grads):
...@@ -1550,8 +1550,8 @@ if (err != CUDNN_STATUS_SUCCESS) { ...@@ -1550,8 +1550,8 @@ if (err != CUDNN_STATUS_SUCCESS) {
# not connected to desc # not connected to desc
return [[1], [0], [0], [0]] return [[1], [0], [0], [0]]
#def c_code_cache_version(self): def c_code_cache_version(self):
# return (8, version()) return (8, version())
class GpuDnnPoolGrad(DnnBase): class GpuDnnPoolGrad(DnnBase):
...@@ -1662,12 +1662,7 @@ if (output_grad%(name)s != NULL) { cudnnDestroyTensorDescriptor(output_grad%(nam ...@@ -1662,12 +1662,7 @@ if (output_grad%(name)s != NULL) { cudnnDestroyTensorDescriptor(output_grad%(nam
if (pool%(name)s != NULL) { cudnnDestroyPoolingDescriptor(pool%(name)s); } if (pool%(name)s != NULL) { cudnnDestroyPoolingDescriptor(pool%(name)s); }
""" % dict(name=name) """ % dict(name=name)
# def perform(self, node, inputs_storage, output_storage):
# output_storage[0][0] = inputs_storage[0].copy()
# return
def c_code(self, node, name, inputs, outputs, sub): def c_code(self, node, name, inputs, outputs, sub):
# raise NotImplementedError()
# Here the name out and inp are based on the cudnn definition. # Here the name out and inp are based on the cudnn definition.
# Not the definition of this class. # Not the definition of this class.
# This make it complicated. # This make it complicated.
...@@ -1770,16 +1765,15 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) { ...@@ -1770,16 +1765,15 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
""" % dict(output_grad=out_grad, """ % dict(output_grad=out_grad,
fail=sub['fail'], name=name, fail=sub['fail'], name=name,
input=inp, input_grad=inp_grad, output=out, input=inp, input_grad=inp_grad, output=out,
input_desc="input"+name, input_desc="input" + name,
input_grad_desc="input_grad"+name, input_grad_desc="input_grad" + name,
output_desc="output"+name, output_desc="output" + name,
output_grad_desc="output_grad"+name, output_grad_desc="output_grad" + name,
mode_flag=mode_flag, nd=node.inputs[0].ndim - 2, mode_flag=mode_flag, nd=node.inputs[0].ndim - 2,
ws=ws, pad=pad, str=stride) ws=ws, pad=pad, str=stride)
def c_code_cache_version(self): def c_code_cache_version(self):
return return (8, version())
#return (7, version())
def infer_shape(self, node, shape): def infer_shape(self, node, shape):
return [shape[0]] return [shape[0]]
...@@ -2351,7 +2345,6 @@ if True: ...@@ -2351,7 +2345,6 @@ if True:
ds, st, pad) ds, st, pad)
return [host_from_gpu(ret)] return [host_from_gpu(ret)]
@register_opt('cudnn') @register_opt('cudnn')
@local_optimizer([GpuSoftmax]) @local_optimizer([GpuSoftmax])
def local_softmax_dnn(node): def local_softmax_dnn(node):
......
...@@ -300,7 +300,8 @@ def test_pooling(): ...@@ -300,7 +300,8 @@ def test_pooling():
# Not implemented # Not implemented
continue continue
pad_ = theano.shared(numpy.array(pad)) pad_ = theano.shared(numpy.array(pad))
## This test the CPU grad + opt + GPU implemtentation
# This test the CPU grad + opt + GPU implemtentation
def fn(x): def fn(x):
return pool_2d(x, (2, 2), ignore_border=True, return pool_2d(x, (2, 2), ignore_border=True,
padding=pad, mode=mode) padding=pad, mode=mode)
...@@ -1005,7 +1006,8 @@ class TestDnnInferShapes(utt.InferShapeTester): ...@@ -1005,7 +1006,8 @@ class TestDnnInferShapes(utt.InferShapeTester):
): ):
self._compile_and_check( self._compile_and_check(
[img], [img],
[dnn.GpuDnnPool(mode=params[2])(img, params[0], params[1], (0,0))], [dnn.GpuDnnPool(mode=params[2])
(img, params[0], params[1], (0, 0))],
[img_val], [img_val],
dnn.GpuDnnPool dnn.GpuDnnPool
) )
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论