tensorflow windows 學習記錄

2021-09-12 12:03:33 字數 1094 閱讀 9775

1. python 版本3.7.1,安裝tensorflow.

pip install tensorflow

pip install numpy --upgrade 

2. 檢視tensorflow 版本

進入python後:

import tensorflow as tf

tf.__version__

3. conda的一些命令

4. 第一段**

import tensorflow as tf

import numpy as np

# 使用 numpy 生成假資料(phony data), 總共 100 個點.

x_data = np.float32(np.random.rand(2, 100)) # 隨機輸入

y_data = np.dot([0.100, 0.200], x_data) + 0.300

# 構造乙個線性模型

b = tf.variable(tf.zeros([1]))

w = tf.variable(tf.random_uniform([1, 2], -1.0, 1.0))

y = tf.matmul(w, x_data) + b

# 最小化方差

loss = tf.reduce_mean(tf.square(y - y_data))

optimizer = tf.train.gradientdescentoptimizer(0.5)

train = optimizer.minimize(loss)

# 初始化變數

#init = tf.initialize_all_variables()

init = tf.global_variables_initializer()

# 啟** (graph)

sess = tf.session()

sess.run(init)

# 擬合平面

for step in range(0, 201):

sess.run(train)

if step % 20 == 0:

print(step, sess.run(w), sess.run(b))

ingress controller學習記錄

按文件操作 wgetwget 在service的spec中將nodeport固定一下。deploy demo.yaml的內容 結果 此時,訪問nodeip nodeport已經可以看到輸出,如圖 建立ingress root master ingress nginx kubectl get ingr...

《學習php與MySQL》隨便記記

初學php.記得都是基本點 每個php語句的結束都要有分號 注釋和c一樣 全域性變數用gobal定義 例如gobal age 靜態變數,static age 0 超級全域性變數,這是預定義的 if elseif else switch,break,while,do.while,for functio...

C 學習年記

經過差不多快一年的學習,c 程式設計算是馬馬虎虎的學的差不多了,對程式設計有了一些了解。今天,當我學完c 後,了解了很多東西,同時得到更多的是對知識的求知與迷惘,發現自己有太多的東西要學,更發現自己在學完這太多的東西之後並不一定能得到自己想要的一些東西,也許這就是大學的生活吧,乙個探索 求知 迷茫 ...