python查看list的shape_AttributeError:“list”对象没有属性“shape”

我正在跟踪Tensorflow CNN的演示代码,我遇到了这个错误,涉及到logging\u hookFile "Machine_Learning/CNN_model_creator.py", line 105, in main

hooks=[logging_hook]

下面是我的代码片段:#create the estimator

clf = tf.estimator.Estimator(model_fn=cnn_model_fn, model_dir="/model")

#set up logging for predictions

#log the values in the "softmax" tensor with label "probabilities"

tensors_to_log = {"probabilities":"softmax_tensor"}

logging_hook = tf.train.LoggingTensorHook(tensors=tensors_to_log, every_n_iter=50)

#train the model_f

train_input_fn = tf.estimator.inputs.numpy_input_fn(

x={"x": train_data},

y=train_labels,

batch_size=100,

num_epochs=None,

shuffle=True

)

clf.train(

input_fn=train_input_fn,

steps=20000,

hooks=[logging_hook]

)

我不完全理解记录_hook的目的,也不明白当它的值传递给hooks时,它为什么需要在一个列表中。感谢任何帮助。在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值