0
点赞
收藏
分享

微信扫一扫

tensorflow 取 sub-tensor 实例

SPEIKE 2022-07-27 阅读 144


import tensorflow as tf

value = [[0,1],[2,3],[4,5],[6,7]]
init = tf.constant_initializer(value)
v = tf.get_variable('value', shape=[4,2], initializer=init,dtype=tf.int32)


v_ = v[:3,:]

init = tf.initialize_all_variables()
sess = tf.Session()
sess.run(init)
print(sess.run(v_))


举报

相关推荐

0 条评论