繁体   English   中英

tf.print 不在控制台中打印打印件

[英]tf.print not printing the prints in the console

我有以下损失 function 包含 tf.print 语句:

@tf.function
def loss(i, o):
  tf.print("i shape is ")
  tf.print(i.shape)
  tf.print("o shape is ")
  tf.print(o.shape)
  loss = tf.math.reduce_sum(tf.abs(i - o))
  tf.print("loss is ")
  tf.print(loss)
  tf.print(loss)
  return loss


并且损失在训练步骤中被称为如下:

l_loss = loss(l_output, x_train_left_noc)

但是,控制台中没有任何打印。 怎样看印记?

import tensorflow as tf
import sys

tensor = tf.range(10)
tf.print(tensor, output_stream=sys.stderr)

我正在使用 tensorflow 2.x
指定output_stream=sys.stderr

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM