tf.scan

import tensorflow as tf
import numpy as np
elems = np.array([1, 2, 3, 4, 5, 6])
sum = tf.scan(lambda a, x: a + x, elems)
# sum == [1, 3, 6, 10, 15, 21]
posted @ 2022-08-19 22:50  luoganttcc  阅读(6)  评论(0)    收藏  举报