提交 6c611b5e authored 作者: sentient07's avatar sentient07

Better handling of tags and added back ShapeOptimizer to fast_compile

上级 6178fc1a
......@@ -292,10 +292,9 @@ class GraphToGPU(NavigatorOptimizer):
for i in fgraph.inputs:
# Do not move *int* scalar to the GPU.
target = getattr(i.tag, 'target', None)
if (target != 'cpu' and
isinstance(i.type, tensor.TensorType) and
if (isinstance(i.type, tensor.TensorType) and
(i.ndim > 0 or 'int' not in i.dtype)):
mapping[i] = as_gpuarray_variable(i, target)
mapping[i] = i.transfer(target)
else:
mapping[i] = i
for i in fgraph.variables:
......
......@@ -1480,7 +1480,7 @@ class UnShapeOptimizer(Optimizer):
# As local_shape_to_shape_i is not in fast_compile,
# dont register this opt in fast_compile.
theano.compile.mode.optdb.register('ShapeOpt', ShapeOptimizer(),
0.1, 'fast_run')
0.1, 'fast_run', 'fast_compile')
# Not enabled by default for now. Some crossentropy opt use the
# shape_feature. They are at step 2.01. uncanonicalize is at step
# 3. After it goes to 48.5 that move to the gpu. So 10 seem resonable.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论