【发布时间】:2018-12-21 12:18:24
【问题描述】:
我已经使用 tensorflow estimator API 构建了一个分类模型。我正在尝试在使用以下代码进行预测时从日志中打印的隐藏层获取张量输出。
model = tf.estimator.DNNLinearCombinedClassifier(
model_dir=model_dir,
linear_feature_columns=wide_columns,
dnn_feature_columns=deep_columns,
dnn_hidden_units=hidden_units,
config=run_config)
tensors_to_log = {"DenseOut": "dnn/logits/BiasAdd"}
logging_hook = tf.train.LoggingTensorHook(tensors=tensors_to_log, every_n_iter=1)
predictions = model.predict(train_input_fn, hooks=[logging_hook])
当我运行代码时,我能够将张量记录在输出中,但由于该值很长,它被截断,我只能在开始和结束时看到几个数字。
INFO:tensorflow:DenseOut = [[ 0.61572325 -0.44044942 -0.19232166 ... 0.04 0.605 0.15]]
如何指定 tensorflow 来记录完整的输出?
【问题讨论】:
标签: python tensorflow logging tensorflow-estimator