简体   繁体   English

根据原始张量的元素索引生成新的张量流张量

[英]Generate new tensorflow tensor according to the element index of original tensor

I have a question about tensorflow tensor. 我对张量流张量有疑问。

If I have a NeuralNet like y=xw+b as an example. 如果我有一个像y = xw + b这样的NeuralNet的例子。

then x is placeholder([7,7] dims), w is Variable([7,1]) and b is Variable([1,1]) 那么x是占位符([7,7]暗淡),w是变量([7,1]),b是变量([1,1])

So, y is tensorflow tensor with [7,1] dims. 因此,y是具有[7,1]暗淡的张量流张量。

then, in this case. 然后,在这种情况下。 can I make a new tensor like 我可以做一个新的张量吗

new_y = [tf.reduce_sum(y[0:3]), tf.reduce_sum(y[3:5]), tf.reduce_sum(y[5:])] new_y = [tf.reduce_sum(y [0:3]),tf.reduce_sum(y [3:5]),tf.reduce_sum(y [5:])]

and use it for training step? 并将其用于训练步骤?

If possible, how can I make it? 如果可能的话,我该如何做?

You should just make your label (y) in your reduced sum format (ie 3 bits), and train to that label. 您应该以缩减的总和格式(即3位)制作标签(y),然后训练该标签。 The neural net should be smart enough to adjust the weights to imitate your reduce_sum logic. 神经网络应该足够聪明,可以调整权重以模仿reduce_sum逻辑。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM