快速调试TF

(tf115) [xxxxx@macpro pai_tf_model]
$ ~/.local/bin/jupyter-console

import tensorflow as tf
A = tf.SparseTensor(indices=[[0, 0], [1, 2]], values=[1, 2], dense_shape=[3, 4])
b = tf.SparseTensor(A.indices, tf.ones_like(A.values, tf.int32), A.dense_shape)
row_count = tf.sparse_reduce_sum(b, axis=1)

sess = tf.InteractiveSession()
sess.run(row_count)
posted @ 2020-08-06 16:01  bregman  阅读(139)  评论(0编辑  收藏  举报