2017-01-27 4 views
1

シンボリックベクトルの逆累積和の求め方は?Tensorflowでベクトルの逆累積和を求める方法

import tensorflow as tf 

input = tf.placeholder('float32', [None]) 
output = some_function(input) 

例えば

入力

input = [1,2,3,4] 

出力あなたがtf.cumsum使用することができます

`output` = [1+2+3+4, 2+3+4, 3+4, 4] = [10, 9, 7, 4] 
+0

これは、行列積[1,2,3,4] * [1 0 0 0; 1 1 0 0; 1 1 1 0; 1 1 1 1] 'となる。 –

答えて

2

import tensorflow as tf 

input = tf.placeholder('float32', [None]) 
output = tf.cumsum(input, reverse=True)