提交 0bebe810 authored 作者: Frederic Bastien's avatar Frederic Bastien 提交者: sentient07

Move mrg_uniform to the GPU

上级 c9752903
......@@ -28,6 +28,7 @@ from theano.gpuarray.basic_ops import GpuKernelBase, Kernel
from theano.gpuarray.type import GpuArrayType
from theano.gpuarray.fp16_help import write_w
from theano.gpuarray.opt import (register_opt as register_gpua,
register_opt2,
host_from_gpu as host_from_gpua)
if theano.sandbox.cuda.cuda_available:
from theano.sandbox.cuda import (CudaNdarrayType,
......@@ -1551,6 +1552,17 @@ class MRG_RandomStreams(object):
return final_samples
@register_opt2([mrg_uniform], 'fast_compile')
def local_gpua_mrg(op, context_name, inputs, outputs):
if (type(op) == mrg_uniform and
isinstance(inputs[0].type, GpuArrayType)):
outs = GPUA_mrg_uniform.new(inputs[0],
op.output_type.ndim,
op.output_type.dtype,
inputs[1])
return [outs[0], host_from_gpua(outs[1])]
@register_gpua('fast_compile')
@local_optimizer([mrg_uniform])
def local_gpua_mrg(node):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论