Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

update to rc1 #940

Merged
merged 2 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
305 changes: 184 additions & 121 deletions paddle2.0_docs/Autoencoder/AutoEncoder.ipynb
100644 → 100755

Large diffs are not rendered by default.

Large diffs are not rendered by default.

94 changes: 47 additions & 47 deletions paddle2.0_docs/dynamic_graph/dynamic_graph.ipynb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"# 动态图\n",
"\n",
"从飞桨开源框架2.0RC版本开始,飞桨默认为用户开启了动态图开发模式。在这种模式下,每次执行一个运算,可以立即得到结果(而不是事先定义好网络结构,然后再执行)。\n",
"从飞桨开源框架2.0RC1版本开始,飞桨默认为用户开启了动态图开发模式。在这种模式下,每次执行一个运算,可以立即得到结果(而不是事先定义好网络结构,然后再执行)。\n",
"\n",
"在动态图模式下,您可以更加方便的组织代码,更容易的调试程序,本示例教程将向你介绍飞桨的动态图的使用。\n"
]
Expand All @@ -17,19 +17,19 @@
"source": [
"## 设置环境\n",
"\n",
"我们将使用飞桨2.0RC版本,从该版本开始,飞桨框架默认开启了动态图模式。"
"我们将使用飞桨2.0RC1版本,从该版本开始,飞桨框架默认开启了动态图模式。"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2.0.0-rc0\n"
"2.0.0-rc1\n"
]
}
],
Expand All @@ -52,27 +52,27 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensor(shape=[4, 2], dtype=float32, place=CPUPlace, stop_gradient=True,\n",
" [[1.60883498, 0.43853286],\n",
" [1.02701402, 1.91869283],\n",
" [-1.14591110, 1.26320088],\n",
" [-0.04009963, 0.42621592]])\n",
" [[-0.84287941, -0.43028113],\n",
" [-0.95773113, 0.47691804],\n",
" [ 0.06073142, -1.07852530],\n",
" [ 0.58765173, -0.16525090]])\n",
"Tensor(shape=[2], dtype=float32, place=CPUPlace, stop_gradient=True,\n",
" [1., 2.])\n",
"Tensor(shape=[4, 2], dtype=float32, place=CPUPlace, stop_gradient=True,\n",
" [[2.60883498, 2.43853283],\n",
" [2.02701402, 3.91869283],\n",
" [-0.14591110, 3.26320076],\n",
" [0.95990038, 2.42621589]])\n",
" [[0.15712059, 1.56971884],\n",
" [0.04226887, 2.47691798],\n",
" [1.06073141, 0.92147470],\n",
" [1.58765173, 1.83474910]])\n",
"Tensor(shape=[4], dtype=float32, place=CPUPlace, stop_gradient=True,\n",
" [2.48590064, 4.86439991, 1.38049066, 0.81233221])\n"
" [-1.70344162, -0.00389504, -2.09631920, 0.25714993])\n"
]
}
],
Expand Down Expand Up @@ -101,22 +101,22 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 +> [5 6 7]\n",
"1 +> [5 7 9]\n",
"1 -> [-3 -3 -3]\n",
"2 +> [ 5 9 15]\n",
"3 -> [-3 3 21]\n",
"4 -> [-3 11 75]\n",
"5 +> [ 5 37 249]\n",
"5 -> [ -3 27 237]\n",
"6 +> [ 5 69 735]\n",
"7 +> [ 5 133 2193]\n",
"8 -> [ -3 251 6555]\n",
"8 +> [ 5 261 6567]\n",
"9 -> [ -3 507 19677]\n"
]
}
Expand Down Expand Up @@ -147,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -173,28 +173,28 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 [1.1263953]\n",
"200 [0.58878094]\n",
"400 [0.44702315]\n",
"600 [0.3890689]\n",
"800 [0.06900629]\n",
"1000 [0.12029597]\n",
"1200 [0.01054306]\n",
"1400 [0.00916436]\n",
"1600 [0.00322669]\n",
"1800 [0.00234438]\n",
"2000 [0.01355543]\n",
"2200 [0.00712038]\n",
"2400 [0.00424345]\n",
"2600 [0.00101277]\n",
"2800 [0.0006593]\n"
"0 [1.3321278]\n",
"200 [0.82869977]\n",
"400 [0.57817966]\n",
"600 [0.47205922]\n",
"800 [0.15331703]\n",
"1000 [0.06435855]\n",
"1200 [0.07417449]\n",
"1400 [0.04293861]\n",
"1600 [0.02513926]\n",
"1800 [0.02017618]\n",
"2000 [0.00986554]\n",
"2200 [0.00199787]\n",
"2400 [0.00101295]\n",
"2600 [0.00083713]\n",
"2800 [0.00051033]\n"
]
}
],
Expand Down Expand Up @@ -237,23 +237,23 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"step: 0, loss: [0.3177247]\n",
"step: 1, loss: [0.28907454]\n",
"step: 2, loss: [0.26719114]\n",
"step: 3, loss: [0.24093461]\n",
"step: 4, loss: [0.20997363]\n",
"step: 5, loss: [0.17817578]\n",
"step: 6, loss: [0.14984149]\n",
"step: 7, loss: [0.12758136]\n",
"step: 8, loss: [0.1117612]\n",
"step: 9, loss: [0.10136593]\n"
"step: 0, loss: [0.33854288]\n",
"step: 1, loss: [0.30896515]\n",
"step: 2, loss: [0.28540164]\n",
"step: 3, loss: [0.25925428]\n",
"step: 4, loss: [0.22952458]\n",
"step: 5, loss: [0.19782335]\n",
"step: 6, loss: [0.16653982]\n",
"step: 7, loss: [0.13852617]\n",
"step: 8, loss: [0.11632853]\n",
"step: 9, loss: [0.10132948]\n"
]
}
],
Expand Down Expand Up @@ -308,7 +308,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.7"
"version": "3.8.2"
}
},
"nbformat": 4,
Expand Down
34 changes: 18 additions & 16 deletions paddle2.0_docs/getting_started/getting_started.ipynb
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"2.0.0-rc0\n"
"2.0.0-rc1\n"
]
}
],
Expand Down Expand Up @@ -68,12 +68,13 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"train_dataset = paddle.vision.datasets.MNIST(mode='train')\n",
"val_dataset = paddle.vision.datasets.MNIST(mode='test')"
"from paddle.vision.transforms import ToTensor\n",
"train_dataset = paddle.vision.datasets.MNIST(mode='train', transform=ToTensor())\n",
"val_dataset = paddle.vision.datasets.MNIST(mode='test', transform=ToTensor())"
]
},
{
Expand All @@ -87,7 +88,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -120,16 +121,17 @@
"name": "stdout",
"output_type": "stream",
"text": [
"The loss value printed in the log is the current step, and the metric is the average value of previous step.\n",
"Epoch 1/5\n",
"step 1875/1875 [==============================] - loss: 0.3993 - acc: 0.8775 - 7ms/step \n",
"step 938/938 [==============================] - loss: 0.0041 - acc: 0.9888 - 20ms/step \n",
"Epoch 2/5\n",
"step 1875/1875 [==============================] - loss: 0.2884 - acc: 0.9061 - 10ms/step \n",
"step 938/938 [==============================] - loss: 0.0052 - acc: 0.9920 - 21ms/step \n",
"Epoch 3/5\n",
"step 1875/1875 [==============================] - loss: 0.2867 - acc: 0.9131 - 12ms/step \n",
"step 938/938 [==============================] - loss: 3.9123e-04 - acc: 0.9935 - 20ms/step \n",
"Epoch 4/5\n",
"step 1875/1875 [==============================] - loss: 0.1562 - acc: 0.9171 - 12ms/step \n",
"step 938/938 [==============================] - loss: 8.1244e-04 - acc: 0.9938 - 19ms/step \n",
"Epoch 5/5\n",
"step 1875/1875 [==============================] - loss: 0.2551 - acc: 0.9204 - 18ms/step \n"
"step 938/938 [==============================] - loss: 0.0052 - acc: 0.9940 - 18ms/step \n"
]
}
],
Expand All @@ -145,7 +147,7 @@
"# 开始模型训练\n",
"model.fit(train_dataset,\n",
" epochs=5, \n",
" batch_size=32,\n",
" batch_size=64,\n",
" verbose=1)"
]
},
Expand All @@ -166,7 +168,7 @@
{
"data": {
"text/plain": [
"{'loss': [0.0], 'acc': 0.9457}"
"{'loss': [0.0], 'acc': 0.9814}"
]
},
"execution_count": 9,
Expand All @@ -182,17 +184,17 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"那么初步训练得到的模型效果在97%附近,我们可以进一步通过调整其中的训练参数来提升我们的模型精度。\n",
"那么初步训练得到的模型效果在98%附近,我们可以进一步通过调整其中的训练参数来提升我们的模型精度。\n",
"\n",
"至此我们可以知道如何通过飞桨的几个简单API来快速完成一个深度学习任务,大家可以针对自己的需求来更换其中的代码,如果需要使用自己的数据集,那么可以更换数据集加载部分程序,如果需要替换模型,那么可以更改模型代码实现等等。我们也为大家提供了很多其他场景的示例代码来教大家如何使用我们的飞桨API,大家可以查看下面的链接或通过页面导航来查看自己感兴趣的部分。"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.7.4 64-bit",
"display_name": "Python 3",
"language": "python",
"name": "python37464bitc4da1ac836094043840bff631bedbf7f"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -204,7 +206,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
"version": "3.8.2"
}
},
"nbformat": 4,
Expand Down
Loading