提交 e5f7eb3a authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Remove the undocumented and unused tag.context_name.

上级 1381698b
......@@ -172,25 +172,24 @@ class InputToGpuOptimizer(Optimizer):
for cl in input.clients)):
continue
target = getattr(input.tag, 'target', None)
if target == 'cpu':
continue
if input.type.dtype.startswith('float'):
default = None
else:
default = 'cpu'
if (not input.type.dtype.startswith('float') and
not hasattr(input.tag, 'target')):
target = getattr(input.tag, 'target', default)
if target == 'cpu':
continue
ctx_name = getattr(input.tag, 'context_name', target)
try:
new_input = host_from_gpu(GpuFromHost(ctx_name)(input))
new_input = host_from_gpu(GpuFromHost(target)(input))
fgraph.replace_validate(input, new_input,
"InputToGpuOptimizer")
except TypeError:
# This could fail if the inputs are not TensorTypes
pass
except ContextNotDefined:
if (hasattr(input.tag, 'context_name') or
hasattr(input.tag, 'target')):
if hasattr(input.tag, 'target'):
raise
# If there is no context tag and no default context
# then it stays on the CPU
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论