提交 f09999ce authored 作者: Iban Harlouchet's avatar Iban Harlouchet 提交者: Iban Harlouchet

flake8 for theano/misc/pycuda_example.py; 2 E left

上级 41e7e36a
...@@ -33,16 +33,14 @@ from theano.sandbox.cuda.basic_ops import (as_cuda_ndarray_variable, ...@@ -33,16 +33,14 @@ from theano.sandbox.cuda.basic_ops import (as_cuda_ndarray_variable,
from theano.sandbox.cuda.opt import gpu_seqopt from theano.sandbox.cuda.opt import gpu_seqopt
from theano.tensor.utils import hash_from_dict from theano.tensor.utils import hash_from_dict
from . import pycuda_init
if not pycuda_init.pycuda_available:
raise Exception("No pycuda available. You can't load pycuda_example.py")
import pycuda import pycuda
from pycuda.elementwise import ElementwiseKernel
from pycuda.compiler import SourceModule from pycuda.compiler import SourceModule
from pycuda.tools import VectorArg
import pycuda.gpuarray import pycuda.gpuarray
from . import pycuda_init
if not pycuda_init.pycuda_available:
raise Exception("No pycuda available. You can't load pycuda_example.py")
def _replace_npy_types(c_arg): def _replace_npy_types(c_arg):
c_arg = c_arg.replace('npy_float32', 'float') c_arg = c_arg.replace('npy_float32', 'float')
...@@ -235,12 +233,11 @@ class PycudaElemwiseSourceModuleOp(GpuOp): ...@@ -235,12 +233,11 @@ class PycudaElemwiseSourceModuleOp(GpuOp):
c_code = self.scalar_op.c_code(out_node, "some_name", c_code = self.scalar_op.c_code(out_node, "some_name",
tuple([n + "[i]" for n in in_name]), tuple([n + "[i]" for n in in_name]),
tuple(n + "[i]" for n in out_name), {}) tuple(n + "[i]" for n in out_name), {})
c_code_param = ", ".join([ c_code_param = ", ".join(
_replace_npy_types(var.type.dtype_specs()[1]) + " *" + name [_replace_npy_types(var.type.dtype_specs()[1]) + " *" + name
for var, name in chain(izip(inputs, in_name), for var, name in chain(izip(inputs, in_name),
izip(out_node.outputs, izip(out_node.outputs, out_name))] +
out_name)) ["int size"])
] + ["int size"])
mod = SourceModule(""" mod = SourceModule("""
__global__ void %s(%s) __global__ void %s(%s)
{ {
...@@ -329,8 +326,8 @@ class PycudaElemwiseSourceModuleMakeThunkOp(Op): ...@@ -329,8 +326,8 @@ class PycudaElemwiseSourceModuleMakeThunkOp(Op):
c_code_param = ", ".join( c_code_param = ", ".join(
[_replace_npy_types(var.type.dtype_specs()[1]) + " *" + name [_replace_npy_types(var.type.dtype_specs()[1]) + " *" + name
for var, name in chain(izip(node.inputs, in_name), for var, name in chain(izip(node.inputs, in_name),
izip(node.outputs, out_name))] izip(node.outputs, out_name))] +
+ ["int size"]) ["int size"])
mod = SourceModule(""" mod = SourceModule("""
__global__ void %s(%s) __global__ void %s(%s)
......
...@@ -184,7 +184,6 @@ whitelist_flake8 = [ ...@@ -184,7 +184,6 @@ whitelist_flake8 = [
"scan_module/scan_opt.py", "scan_module/scan_opt.py",
"scan_module/tests/test_scan.py", "scan_module/tests/test_scan.py",
"scan_module/tests/test_scan_opt.py", "scan_module/tests/test_scan_opt.py",
"misc/pycuda_example.py",
"misc/ordered_set.py", "misc/ordered_set.py",
"misc/strutil.py", "misc/strutil.py",
"misc/gnumpy_utils.py", "misc/gnumpy_utils.py",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论