分布式Tensorflow:TypeError:__ init __()为关键字参数'dtype'获取了多个值

时间:2017-02-09 08:27:58

标签: tensorflow distributed

inception distributed training tutorial之后运行分布式张量流时,我遇到以下错误:

Traceback (most recent call last):
  File "/home/AIJ/tf_models/models/inception/bazel-bin/inception/imagenet_distributed_train.runfiles/inception/inception/imagenet_distributed_train.py", line 65, in <module>
    tf.app.run()
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "/home/AIJ/tf_models/models/inception/bazel-bin/inception/imagenet_distributed_train.runfiles/inception/inception/imagenet_distributed_train.py", line 61, in main
    inception_distributed_train.train(server.target, dataset, cluster_spec)
  File "/home/AIJ/tf_models/models/inception/bazel-bin/inception/imagenet_distributed_train.runfiles/inception/inception/inception_distributed_train.py", line 120, in train
    global_step = slim.variables.global_step()
  File "/home/AIJ/tf_models/models/inception/bazel-bin/inception/imagenet_distributed_train.runfiles/inception/inception/slim/scopes.py", line 155, in func_with_args
    return func(*args, **current_args)
  File "/home/AIJ/tf_models/models/inception/bazel-bin/inception/imagenet_distributed_train.runfiles/inception/inception/slim/variables.py", line 244, in global_step
    trainable=False, collections=collections)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variable_scope.py", line 988, in get_variable
    custom_getter=custom_getter)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variable_scope.py", line 890, in get_variable
    custom_getter=custom_getter)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variable_scope.py", line 348, in get_variable
    validate_shape=validate_shape)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variable_scope.py", line 333, in _true_getter
    caching_device=caching_device, validate_shape=validate_shape)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variable_scope.py", line 684, in _get_single_variable
    validate_shape=validate_shape)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variables.py", line 226, in __init__
    expected_shape=expected_shape)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variables.py", line 303, in _init_from_args
    initial_value(), name="initial_value", dtype=dtype)
  File "/home/AIJ/tensorflow/_python_build/tensorflow/python/ops/variable_scope.py", line 673, in <lambda>
    shape.as_list(), dtype=dtype, partition_info=partition_info)
TypeError: __init__() got multiple values for keyword argument 'dtype'

我认为这个问题是由于slim中某处的api不匹配造成的。我使用的tensorflow版本是v1.0.0-alpha。有人可以帮我吗?提前谢谢!

1 个答案:

答案 0 :(得分:1)

问题解决了。这可能是由于api不匹配。解决方案是将inception/slim/variables.py中的第243行更改为initializer=tf.zeros_initializer()

请告诉我是否有任何错误。