Skip to content

Commit

Permalink
revise readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lyhue1991 committed May 6, 2020
1 parent 430d6ea commit 7b39023
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion 1-3,文本数据建模流程范例.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ _________________________________________________________________
@tf.function
def printbar():
today_ts = tf.timestamp()%(24*60*60)

hour = tf.cast(today_ts//3600+8,tf.int32)%tf.constant(24)
minite = tf.cast((today_ts%3600)//60,tf.int32)
second = tf.cast(tf.floor(today_ts%60),tf.int32)
Expand Down
5 changes: 2 additions & 3 deletions 3-1,低阶API示范.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def printbar():
timeformat(second)],separator = ":")
tf.print("=========="*8+timestring)


```

```python
Expand Down Expand Up @@ -86,7 +85,7 @@ def data_iter(features, labels, batch_size=8):
np.random.shuffle(indices) #样本的读取顺序是随机的
for i in range(0, num_examples, batch_size):
indexs = indices[i: min(i + batch_size, num_examples)]
yield tf.gather(X,indexs), tf.gather(Y,indexs)
yield tf.gather(features,indexs), tf.gather(labels,indexs)

# 测试数据管道效果
batch_size = 8
Expand Down Expand Up @@ -356,7 +355,7 @@ def data_iter(features, labels, batch_size=8):
np.random.shuffle(indices) #样本的读取顺序是随机的
for i in range(0, num_examples, batch_size):
indexs = indices[i: min(i + batch_size, num_examples)]
yield tf.gather(X,indexs), tf.gather(Y,indexs)
yield tf.gather(features,indexs), tf.gather(labels,indexs)

# 测试数据管道效果
batch_size = 10
Expand Down
2 changes: 1 addition & 1 deletion 5-5,损失函数losses.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ model.add(layers.Dense(64, input_dim=64,
model.add(layers.Dense(10,
kernel_regularizer=regularizers.l1_l2(0.01,0.01),activation = "sigmoid"))
model.compile(optimizer = "rmsprop",
loss = "sparse_categorical_crossentropy",metrics = ["AUC"])
loss = "binary_crossentropy",metrics = ["AUC"])
model.summary()

```
Expand Down
6 changes: 2 additions & 4 deletions 6-2,训练模型的3种方法.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ from tensorflow.keras import *
#打印时间分割线
@tf.function
def printbar():
ts = tf.timestamp()
today_ts = ts%(24*60*60)
today_ts = tf.timestamp()%(24*60*60)

hour = tf.cast(today_ts//3600+8,tf.int32)%tf.constant(24)
minite = tf.cast((today_ts%3600)//60,tf.int32)
Expand All @@ -29,8 +28,7 @@ def printbar():

timestring = tf.strings.join([timeformat(hour),timeformat(minite),
timeformat(second)],separator = ":")
tf.print("=========="*8,end = "")
tf.print(timestring)
tf.print("=========="*8+timestring)

```

Expand Down
6 changes: 2 additions & 4 deletions 6-3,使用单GPU训练模型.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ from tensorflow.keras import *
#打印时间分割线
@tf.function
def printbar():
ts = tf.timestamp()
today_ts = ts%(24*60*60)
today_ts = tf.timestamp()%(24*60*60)

hour = tf.cast(today_ts//3600+8,tf.int32)%tf.constant(24)
minite = tf.cast((today_ts%3600)//60,tf.int32)
Expand All @@ -53,8 +52,7 @@ def printbar():

timestring = tf.strings.join([timeformat(hour),timeformat(minite),
timeformat(second)],separator = ":")
tf.print("=========="*8,end = "")
tf.print(timestring)
tf.print("=========="*8+timestring)

```

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,14 @@ Please leave comments in the WeChat official account "Python与算法之美" (El
```python

```



# 30天吃掉那只 TensorFlow2

📚 gitbook电子书地址: https://lyhue1991.github.io/eat_tensorflow2_in_30_days

🚀 github项目地址:https://github.com/lyhue1991/eat_tensorflow2_in_30_days

🐳 kesci专栏地址:https://www.kesci.com/home/column/5d8ef3c3037db3002d3aa3a0


### 一,TensorFlow2 🍎 or Pytorch🔥

Expand Down Expand Up @@ -360,6 +359,10 @@ tf.keras绝大部分功能和兼容多种后端的Keras库用法完全一样,

为了直接能够在jupyter中打开markdown文件,建议安装jupytext,将markdown转换成ipynb文件。

**此外,本项目也与和鲸社区达成了合作,可以在和鲸专栏fork本项目,并直接在云笔记本上运行代码,避免环境配置痛苦。**

🐳和鲸专栏地址:https://www.kesci.com/home/column/5d8ef3c3037db3002d3aa3a0

```python
#克隆本书源码到本地,使用码云镜像仓库国内下载速度更快
#!git clone https://gitee.com/Python_Ai_Road/eat_tensorflow2_in_30_days
Expand Down Expand Up @@ -388,6 +391,9 @@ tensorflow version: 2.1.0
hello tensorflow2
```




```python

```
Expand Down
2 changes: 1 addition & 1 deletion push-to-github.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# !git push origin master

# !git push gitee master
# !git push -f gitee master

# ## 创建pages分支

Expand Down

0 comments on commit 7b39023

Please sign in to comment.