【问题标题】:How do I return just one element from this output?如何从此输出中只返回一个元素?
【发布时间】:2023-02-11 15:54:16
【问题描述】:

我在 Python 中使用 TensorFlow。使用我的模型进行预测时,这是我的输入:

UberLyft_model.predict(my_UberLyft_encoded)

我得到这个输出:

1/1 [==============================] - 0s 53ms/step
array([[16.11945]], dtype=float32)

但我只是想要这个输出:

16.11945

【问题讨论】:

    标签: python tensorflow tensorflow2.0 tensor


    【解决方案1】:

    尝试

    prediction = UberLyft_model.predict(my_UberLyft_encoded)
    result = prediction[0][0]
    print(result)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-05
      • 1970-01-01
      • 1970-01-01
      • 2016-10-21
      • 2016-06-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多