Keras K.mean

>>> bb
<tf.Tensor: shape=(5,), dtype=int32, numpy=array([1, 1, 1, 0, 0])>
>>> tf.reduce_mean(bb)
<tf.Tensor: shape=(), dtype=int32, numpy=0>
>>> bb = tf.convert_to_tensor([1,1,1,0,0],dtype=tf.float32)
>>> tf.reduce_mean(bb)
<tf.Tensor: shape=(), dtype=float32, numpy=0.6>
>>>
 

 

 

如果,tensor类型是int类型的话,那么不管是tf.redunce_mean(),还是说使用K.mean(),都直接会是0

相关文章:

  • 2021-10-09
  • 2021-10-02
  • 2021-09-10
  • 2021-11-25
  • 2021-10-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-01
  • 2021-07-22
  • 2021-08-26
  • 2021-12-03
  • 2021-05-02
  • 2021-06-22
相关资源
相似解决方案