math_ops.floor equivalent in Keras

前端 未结 1 1403
挽巷
挽巷 2021-01-20 23:42

I\'m trying to implement a custom layer in Keras where I need to convert a tensor of floats [a, 1+a) to a binary tensor for masking. I can see that Tensorflow has a

相关标签:
1条回答
  • 2021-01-21 00:09

    As requested by OP, I will mention the answer I gave in my comment and elaborate more:

    Short answer: you won't encounter any major problems if you use tf.floor().

    Long answer: Using Keras backend functions (i.e. keras.backend.*) is necessary in those cases when 1) there is a need to pre-process or augment the argument(s) passed to actual function of Tensorflow or Theano backend or post-process the returned results. For example, the mean method in backend can also work with boolean tensors as input, however the reduce_mean method in TF expects numerical types as input; or 2) you want to write a model that works across all the Keras supported backends.

    Otherwise, it is fine to use most of real backend functions directly; however, if the function has been defined in keras.backend module, then it is recommended to use that instead.

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