提交 27dd85e9 authored 作者: Dustin Webb's avatar Dustin Webb

Changed the way the opt is registered however it still is not being optimized out.

上级 a4d2db75
...@@ -1814,15 +1814,11 @@ gpu_inplace_elemwise_optimizer = tensor.opt.inplace_elemwise_optimizer_op( ...@@ -1814,15 +1814,11 @@ gpu_inplace_elemwise_optimizer = tensor.opt.inplace_elemwise_optimizer_op(
optdb.register('gpu_inplace_elemwise_opt', gpu_inplace_elemwise_optimizer, 75, optdb.register('gpu_inplace_elemwise_opt', gpu_inplace_elemwise_optimizer, 75,
'fast_run', 'inplace', 'gpu_inplace') 'fast_run', 'inplace', 'gpu_inplace')
gpu_local_elemwise_alloc = tensor.opt.register_specialize_device( gpu_elemwise_alloc = gof.local_optimizer([GpuElemwise])(
gof.local_optimizer([GpuElemwise])( tensor.opt.local_elemwise_alloc_op(GpuElemwise, GpuAlloc, GpuDimShuffle)
tensor.opt.local_elemwise_alloc_op(
GpuElemwise,
GpuAlloc,
GpuDimShuffle
)
)
) )
register_opt()(gpu_elemwise_alloc)
tensor.opt.register_specialize_device(gpu_elemwise_alloc)
@register_opt() @register_opt()
@local_optimizer([tensor.alloc]) @local_optimizer([tensor.alloc])
......
...@@ -124,7 +124,6 @@ class Test_local_elemwise_alloc(unittest.TestCase): ...@@ -124,7 +124,6 @@ class Test_local_elemwise_alloc(unittest.TestCase):
self._verify_assert_count(func, 0) self._verify_assert_count(func, 0)
# Optimization on alloc with assert # Optimization on alloc with assert
"""
func = theano.function( func = theano.function(
[self.vec, self.mat], [self.vec, self.mat],
self.alloc_wo_dep + self.mat, self.alloc_wo_dep + self.mat,
...@@ -133,7 +132,6 @@ class Test_local_elemwise_alloc(unittest.TestCase): ...@@ -133,7 +132,6 @@ class Test_local_elemwise_alloc(unittest.TestCase):
import ipdb; ipdb.set_trace() import ipdb; ipdb.set_trace()
self._verify_alloc_count(func, 0) self._verify_alloc_count(func, 0)
self._verify_assert_count(func, 1) self._verify_assert_count(func, 1)
"""
# No optimization on alloc without assert # No optimization on alloc without assert
func = theano.function( func = theano.function(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论