tensorflow创建变量不在当前变量范围内

时间:2018-07-23 09:56:02

标签: tensorflow

虽然我在tensorflow.contribute中测试了cycle-gan,但我发现ModelX2Y的重构生成器不在可变范围的ModelY2X / Generator中,而是在Generator中。

  with variable_scope.variable_scope(model_x2y_scope):
    model_x2y = _define_partial_model(data_x, data_y)  # in scope "ModelX2Y"
  with variable_scope.variable_scope(model_y2x_scope):
    model_y2x = _define_partial_model(data_y, data_x)  # in scope "ModelY2X"

  with variable_scope.variable_scope(model_y2x.generator_scope, reuse=True):
    reconstructed_x = model_y2x.generator_fn(model_x2y.generated_data)  # in scope "Generator", which I think should be the value of model_y2x.generator_scope: "ModelY2X/Generator"
  with variable_scope.variable_scope(model_x2y.generator_scope, reuse=True):
    reconstructed_y = model_x2y.generator_fn(model_y2x.generated_data) # in scope "Generator_1", which I think should be the value of model_x2y.generator_scope: "ModelX2Y/Generator"

我真的很困惑,我无法通过tf-docs / google / so得到答案。有人告诉我原因吗?将不胜感激。

0 个答案:

没有答案