utils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:seglink 作者: bgshih 项目源码 文件源码
def print_tensor_summary(tensor, tag=None, n_print=21):
  tensor_min = tf.reduce_min(tensor)
  tensor_max = tf.reduce_max(tensor)
  tensor_avg = tf.reduce_mean(tensor)
  tensor_zero_fraction = tf.nn.zero_fraction(tensor)
  tensor_shape = tf.shape(tensor)
  tag = tag or tensor.name
  tensor = tf.Print(tensor,
                    [tensor_min, tensor_max, tensor_avg, tensor_zero_fraction, tensor_shape, tensor],
                    message=(tag + ' Min, max, mean, sparsity, shape, value:'),
                    summarize=n_print)
  return tensor
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号