提交 6c5ab287 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Some flake8 work (but the file does not pass yet).

上级 4450770c
......@@ -56,9 +56,9 @@ class GpuArrayType(Type):
data.typecode, str(data.dtype)))
# fallthrough to ndim check
elif (allow_downcast or
(allow_downcast is None and
type(data) == float and
self.dtype == theano.config.floatX)):
(allow_downcast is None and
type(data) == float and
self.dtype == config.floatX)):
data = gpuarray.array(data, dtype=self.typecode, copy=False,
ndmin=len(self.broadcastable))
else:
......@@ -162,18 +162,15 @@ class GpuArrayType(Type):
def convert_variable(self, var):
if (type(self) == type(var.type) and
self.typecode == var.type.typecode and
self.ndim == var.type.ndim and
all(sb == ob or ob for sb, ob in zip(self.broadcastable,
var.type.broadcastable))):
self.typecode == var.type.typecode and
self.ndim == var.type.ndim and
all(sb == ob or ob for sb, ob in zip(self.broadcastable,
var.type.broadcastable))):
return theano.tensor.patternbroadcast(var, self.broadcastable)
def __hash__(self):
return (hash(self.typecode) ^ hash(self.broadcastable))
def __str__(self):
return "GpuArray<%s>" % (self.dtype,)
def dtype_specs(self):
"""Return a tuple (python type, c type, numpy typenum) that corresponds
to self.dtype.
......@@ -262,9 +259,9 @@ class GpuArrayType(Type):
def c_headers(self):
# We need arrayobject for the PyArrayDescr struct def
# (even if we just use a pointer to it in a function def)
return ['<gpuarray/array.h>', '<gpuarray/kernel.h>', '<gpuarray/error.h>',
'<gpuarray/buffer_blas.h>', '<numpy/arrayobject.h>',
'<gpuarray_api.h>']
return ['<gpuarray/array.h>', '<gpuarray/kernel.h>',
'<gpuarray/error.h>', '<gpuarray/buffer_blas.h>',
'<numpy/arrayobject.h>', '<gpuarray_api.h>']
def c_header_dirs(self):
return [pygpu.get_include(), numpy.get_include()]
......@@ -296,8 +293,9 @@ GpuArrayType.Variable = GpuArrayVariable
class GpuArraySignature(tensor.TensorConstantSignature):
pass # might do something better if we can run the sum on the
# GPU, but for now this will suffice.
# might do something better if we can run the sum on the GPU, but
# for now this will suffice.
pass
class GpuArrayConstant(_operators, Constant):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论