提交 39bb1acb authored 作者: Frederic Bastien's avatar Frederic Bastien

flake8

上级 1192e800
# TODO test dtype != float32
from __future__ import absolute_import, print_function, division
import os
import pygpu
......@@ -6,13 +7,12 @@ import pygpu
import theano
import theano.sandbox.multinomial
from theano import Apply, config
from theano.gof import Op, local_optimizer
from theano.gof import Op
from theano.tensor import NotScalarConstantError, get_scalar_constant_value
from theano.sandbox import gpuarray
from .basic_ops import as_gpuarray_variable, infer_context_name
from .fp16_help import write_w
from .opt import register_opt, op_lifter
from .type import gpu_context_type, GpuArrayType
from .type import GpuArrayType
class GPUAMultinomialFromUniform(gpuarray.basic_ops.GpuKernelBase, Op):
......@@ -60,7 +60,6 @@ class GPUAMultinomialFromUniform(gpuarray.basic_ops.GpuKernelBase, Op):
return Apply(self, [pvals, unis], [out])
def gpu_kernels(self, node, name):
dtype = node.outputs[0].dtype
code = """
KERNEL void k_multi_warp_multinomial(
const ga_size nb_multi,
......@@ -113,8 +112,7 @@ KERNEL void k_multi_warp_multinomial(
pygpu.gpuarray.SSIZE,
pygpu.gpuarray.GpuArray,
pygpu.gpuarray.SSIZE,
pygpu.gpuarray.SSIZE
],
pygpu.gpuarray.SSIZE],
flags=gpuarray.basic_ops.Kernel.get_flags(node.outputs[0].dtype),
objvar='k_multi_warp_multinomial_' + name)]
......@@ -123,7 +121,6 @@ KERNEL void k_multi_warp_multinomial(
out, = outputs
fail = sub['fail']
ctx = sub['params']
#typecode = pygpu.gpuarray.dtype_to_typecode(self.dtype)
sync = bool(config.gpuarray.sync)
kname = self.gpu_kernels(node, name)[0].objvar
s = """
......
......@@ -5,19 +5,14 @@ import numpy
import theano
from theano import config, function, tensor
from ..multinomial import GPUAMultinomialFromUniform
from theano.compile.mode import get_default_mode, predefined_linkers
import theano.tests.unittest_tools as utt
from .config import mode_with_gpu, mode_without_gpu, test_ctx_name
from .config import mode_with_gpu, mode_without_gpu
def get_mode(gpu):
mode = get_default_mode()
if theano.config.mode == 'FAST_COMPILE':
mode = theano.compile.get_mode('FAST_RUN')
mode = mode_without_gpu
if gpu:
mode = mode.including('gpuarray', 'gpu_local_optimizations',
'local_cut_gpu_host_gpu',
'local_gpu_multinomial')
mode = mode_with_gpu
return mode
......
......@@ -9,7 +9,7 @@ import numpy
import theano
from theano import config, function, tensor
from theano.sandbox import multinomial
from theano.compile.mode import get_default_mode, predefined_linkers
from theano.compile.mode import get_default_mode
import theano.sandbox.cuda as cuda
import theano.tests.unittest_tools as utt
from theano.compat import PY3
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论