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

Remove the undocumented and unused tag.context_name.

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