[英]Keras - How to get only one tensor from a batch of tensors?
I have a batch of tensors of shape ?,192
.我有一批形状为?,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.结果张量的形状应该是1,192
,注意这应该在 Keras 中完成。 Any idea of how to get this done?知道如何完成这项工作吗?
该问题已通过带有 lambda 函数的 tensorflow 操作解决
Var= Lambda(lambda inputs: tf.gather_nd(inputs, [[0]]) )(Var)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.