简体   繁体   中英

Keras - How to get only one tensor from a batch of tensors?

I have a batch of tensors of shape ?,192 . Now I want to get any single random tensor from this batch. the resulting tensor should have the shape of 1,192 , note that this should be done in Keras. Any idea of how to get this done?

该问题已通过带有 lambda 函数的 tensorflow 操作解决

Var= Lambda(lambda inputs: tf.gather_nd(inputs, [[0]]) )(Var)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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