Keras : How to find indices from a tensor for a particular value similar to numpy.where()

前端 未结 1 1052
梦毁少年i
梦毁少年i 2021-01-17 17:22

I am searching for a Keras command which is similar to python \"numpy.where()\" command. Basically, my idea is to extract the indices from a tensor. In python I

1条回答
  •  执笔经年
    2021-01-17 18:10

    You should try something like:

    from keras import backend as K
    value = 5
    wh = K.tf.where(K.tf.equal(x,value))
    

    when your backend is tensorflow.

    Hope that helps

    0 讨论(0)
提交回复
热议问题