首页 > 学院 > 开发设计 > 正文

tf.strided_slice 实例

2019-11-06 08:23:55
字体:
来源:转载
供稿:网友
import tensorflow as tfdata = [1,2,3,4,5,6,7,8]x = tf.strided_slice(data,[0],[4])y = tf.strided_slice(data,[1],[5])with tf.session() as sess: PRint(sess.run(x)) print(sess.run(y))

结果 [1 2 3 4] [2 3 4 5]

import tensorflow as tfdata = [[1,2,3,4,5,6,7,8],[11,12,13,14,15,16,17,18]]x = tf.strided_slice(data,[0,0],[1,4])y = tf.strided_slice(data,[1,1],[2,5])with tf.Session() as sess: print(sess.run(x)) print(sess.run(y))

结果 [[1 2 3 4]] [[12 13 14 15]]


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表