tf.placeholder

	tf.placeholder
		tf.placeholder(
		    dtype,
		    shape=None,
		    name=None
		)

参数

dtype是必须的
shape可以没有 如果缺省则表示 可以接受符合类型的任意shape数据(这点要多注意,有时候会很方面,因为tensorlfow好多op 支持broadcast操作)

tf.Varibale

  __init__(
    initial_value=None,
    trainable=True,
    collections=None,
    validate_shape=True,
    caching_device=None,
    name=None,
    variable_def=None,
    dtype=None,
    expected_shape=None,
    import_scope=None,
    constraint=None,
    use_resource=None,
    synchronization=tf.VariableSynchronization.AUTO,
    aggregation=tf.VariableAggregation.NONE
)

这个没什么讲的 这里引申一下讲两个方法:

tf.global_variables()用来获取构造的图中所包含的所有的变量
tf.trainable_variales() 用来获取构造的图中所包含的所有的需要训练的变量
看了一下 有的博客说需要初始化才能使用(亲自测试了一下,是错误的),不过如果你要打印变量的值需要先进行初始化

以上所有的知识点 都在下面的这段代码中体现(代码出处.)

tf.Varibale tf.placeholder tf.global_variables() tf.trainable_variales()
tf.Varibale tf.placeholder tf.global_variables() tf.trainable_variales()tf.Varibale tf.placeholder tf.global_variables() tf.trainable_variales()

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-26
  • 2022-12-23
  • 2021-10-29
  • 2021-11-08
  • 2022-01-05
  • 2021-05-22
相关资源
相似解决方案