關(guān)于TensorFlow、Keras、Python版本匹配一覽表
TensorFlow、Keras、Python 版本匹配一覽表
興沖沖裝完軟件,發(fā)現(xiàn)運行不了,查了下資料,發(fā)現(xiàn)是TensorFlow、Keras、Python 版本匹配問題。
這里提供一個版本匹配清單,需要嚴(yán)格按此標(biāo)準(zhǔn)安裝。
版本匹配清單
| Framework | Env name | Description |
|---|---|---|
| TensorFlow 2.2 | tensorflow-2.2 | TensorFlow 2.2.0 + Keras 2.3.1 on Python 3.7. |
| TensorFlow 2.1 | tensorflow-2.1 | TensorFlow 2.1.0 + Keras 2.3.1 on Python 3.6. |
| TensorFlow 2.0 | tensorflow-2.0 | TensorFlow 2.0.0 + Keras 2.3.1 on Python 3.6. |
| TensorFlow 1.15 | tensorflow-1.15 | TensorFlow 1.15.0 + Keras 2.3.1 on Python 3.6. |
| TensorFlow 1.14 | tensorflow-1.14 | TensorFlow 1.14.0 + Keras 2.2.5 on Python 3.6. |
| TensorFlow 1.13 | tensorflow-1.13 | TensorFlow 1.13.0 + Keras 2.2.4 on Python 3.6. |
| TensorFlow 1.12 | tensorflow-1.12 | TensorFlow 1.12.0 + Keras 2.2.4 on Python 3.6. |
| tensorflow-1.12:py2 | TensorFlow 1.12.0 + Keras 2.2.4 on Python 2. | |
| TensorFlow 1.11 | tensorflow-1.11 | TensorFlow 1.11.0 + Keras 2.2.4 on Python 3.6. |
| tensorflow-1.11:py2 | TensorFlow 1.11.0 + Keras 2.2.4 on Python 2. | |
| TensorFlow 1.10 | tensorflow-1.10 | TensorFlow 1.10.0 + Keras 2.2.0 on Python 3.6. |
| tensorflow-1.10:py2 | TensorFlow 1.10.0 + Keras 2.2.0 on Python 2. | |
| TensorFlow 1.9 | tensorflow-1.9 | TensorFlow 1.9.0 + Keras 2.2.0 on Python 3.6. |
| tensorflow-1.9:py2 | TensorFlow 1.9.0 + Keras 2.2.0 on Python 2. | |
| TensorFlow 1.8 | tensorflow-1.8 | TensorFlow 1.8.0 + Keras 2.1.6 on Python 3.6. |
| tensorflow-1.8:py2 | TensorFlow 1.8.0 + Keras 2.1.6 on Python 2. | |
| TensorFlow 1.7 | tensorflow-1.7 | TensorFlow 1.7.0 + Keras 2.1.6 on Python 3.6. |
| tensorflow-1.7:py2 | TensorFlow 1.7.0 + Keras 2.1.6 on Python 2. | |
| TensorFlow 1.5 | tensorflow-1.5 | TensorFlow 1.5.0 + Keras 2.1.6 on Python 3.6. |
| tensorflow-1.5:py2 | TensorFlow 1.5.0 + Keras 2.0.8 on Python 2. | |
| TensorFlow 1.4 | tensorflow-1.4 | TensorFlow 1.4.0 + Keras 2.0.8 on Python 3.6. |
| tensorflow-1.4:py2 | TensorFlow 1.4.0 + Keras 2.0.8 on Python 2. | |
| TensorFlow 1.3 | tensorflow-1.3 | TensorFlow 1.3.0 + Keras 2.0.6 on Python 3.6. |
| tensorflow-1.3:py2 | TensorFlow 1.3.0 + Keras 2.0.6 on Python 2. |
附上一段測試程序(鳶尾花分類簡化版)
這一段代碼不需要準(zhǔn)備數(shù)據(jù)文件,可直接驗證是否可以訓(xùn)練模型。
#ex7-2.py
#導(dǎo)入庫包
import numpy as np
import keras
import matplotlib.pyplot as plt
from keras.models import Sequential
from keras.layers import Dense
#讀入數(shù)據(jù)
train_x = np.array([[1.4, 0.2],
[1.7, 0.4],
[1.5, 0.4],
[2.3, 0.7],
[2.7, 1.1],
[2.6, 0.9],
[4.6, 1.3],
[3.5, 1.0],
[3.9, 1.2]])
train_y = np.array([[1, 0, 0],
[1, 0, 0],
[1, 0, 0],
[0, 1, 0],
[0, 1, 0],
[0, 1, 0],
[0, 0, 1],
[0, 0, 1],
[0, 0, 1]])
#搭建模型
model = Sequential()
model.add(Dense(units = 2, input_dim = 2))
#model.add(Dense(units = 2, input_dim = 2, activation = 'sigmoid'))
model.add(Dense(units = 3, activation = 'softmax'))
#編譯模型
model.compile(optimizer = 'adam', loss = 'mse')
#訓(xùn)練模型
model.fit(x = train_x, y = train_y, epochs = 10000)
#保存模型
keras.models.save_model(model, 'iris2.model')
總結(jié)
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
python中字典元素的創(chuàng)建、獲取和遍歷等字典知識點
本文介紹了Python中的字典操作,包括字典的創(chuàng)建、元素獲?。ㄊ褂面I和get()方法)、刪除與清空(del和clear())、增加新鍵值對、修改已有值、獲取鍵、值和鍵值對以及遍歷字典的方法,同時闡述了字典的特點,如鍵的唯一性和無序性,以及字典生成式的使用2024-11-11
使用Pytorch訓(xùn)練two-head網(wǎng)絡(luò)的操作
這篇文章主要介紹了使用Pytorch訓(xùn)練two-head網(wǎng)絡(luò)的操作,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2021-05-05
pytorch中Tensor.to(device)和model.to(device)的區(qū)別及說明
這篇文章主要介紹了pytorch中Tensor.to(device)和model.to(device)的區(qū)別及說明,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2022-07-07
Python 3.10 的首個 PEP 誕生,內(nèi)置類型 zip() 迎來新特性(推薦)
這篇文章主要介紹了Python 3.10 的首個 PEP 誕生,內(nèi)置類型 zip() 迎來新特性,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-07-07
python3在各種服務(wù)器環(huán)境中安裝配置過程
這篇文章主要介紹了python3在各種服務(wù)器環(huán)境中安裝配置過程,源碼包編譯安裝步驟詳解,本文通過圖文并茂的形式給大家介紹的非常詳細(xì),需要的朋友可以參考下2022-01-01
python批量從es取數(shù)據(jù)的方法(文檔數(shù)超過10000)
今天小編就為大家分享一篇python批量從es取數(shù)據(jù)的方法(文檔數(shù)超過10000),具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-12-12

