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

Revert "Update 01.fit_a_line API's using Paddle 1.6" #822

Merged
merged 1 commit into from
Oct 14, 2019
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
4 changes: 2 additions & 2 deletions 01.fit_a_line/README.cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ test_reader = paddle.batch(
训练程序的目的是定义一个训练模型的网络结构。对于线性回归来讲,它就是一个从输入到输出的简单的全连接层。更加复杂的结果,比如卷积神经网络,递归神经网络等会在随后的章节中介绍。训练程序必须返回`平均损失`作为第一个返回值,因为它会被后面反向传播算法所用到。

```python
x = fluid.data(name='x', shape=[-1, 13], dtype='float32') # 定义输入的形状和数据类型
y = fluid.data(name='y', shape=[-1, 1], dtype='float32') # 定义输出的形状和数据类型
x = fluid.layers.data(name='x', shape=[13], dtype='float32') # 定义输入的形状和数据类型
y = fluid.layers.data(name='y', shape=[1], dtype='float32') # 定义输出的形状和数据类型
y_predict = fluid.layers.fc(input=x, size=1, act=None) # 连接输入和输出的全连接层

main_program = fluid.default_main_program() # 获取默认/全局主函数
Expand Down
4 changes: 2 additions & 2 deletions 01.fit_a_line/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ test_reader = paddle.batch(
The aim of the program for training is to define a network structure of a training model. For linear regression, it is a simple fully connected layer from input to output. More complex result, such as Convolutional Neural Network and Recurrent Neural Network, will be introduced in later chapters. It must return `mean error` as the first return value in program for training, for that `mean error` will be used for BackPropagation.

```python
x = fluid.data(name='x', shape=[-1, 13], dtype='float32') # define shape and data type of input
y = fluid.data(name='y', shape=[-1, 1], dtype='float32') # define shape and data type of output
x = fluid.layers.data(name='x', shape=[13], dtype='float32') # define shape and data type of input
y = fluid.layers.data(name='y', shape=[1], dtype='float32') # define shape and data type of output
y_predict = fluid.layers.fc(input=x, size=1, act=None) # fully connected layer connecting input and output

main_program = fluid.default_main_program() # get default/global main function
Expand Down
4 changes: 2 additions & 2 deletions 01.fit_a_line/index.cn.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@
训练程序的目的是定义一个训练模型的网络结构。对于线性回归来讲,它就是一个从输入到输出的简单的全连接层。更加复杂的结果,比如卷积神经网络,递归神经网络等会在随后的章节中介绍。训练程序必须返回`平均损失`作为第一个返回值,因为它会被后面反向传播算法所用到。

```python
x = fluid.data(name='x', shape=[-1, 13], dtype='float32') # 定义输入的形状和数据类型
y = fluid.data(name='y', shape=[-1, 1], dtype='float32') # 定义输出的形状和数据类型
x = fluid.layers.data(name='x', shape=[13], dtype='float32') # 定义输入的形状和数据类型
y = fluid.layers.data(name='y', shape=[1], dtype='float32') # 定义输出的形状和数据类型
y_predict = fluid.layers.fc(input=x, size=1, act=None) # 连接输入和输出的全连接层

main_program = fluid.default_main_program() # 获取默认/全局主函数
Expand Down
4 changes: 2 additions & 2 deletions 01.fit_a_line/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@
The aim of the program for training is to define a network structure of a training model. For linear regression, it is a simple fully connected layer from input to output. More complex result, such as Convolutional Neural Network and Recurrent Neural Network, will be introduced in later chapters. It must return `mean error` as the first return value in program for training, for that `mean error` will be used for BackPropagation.

```python
x = fluid.data(name='x', shape=[-1, 13], dtype='float32') # define shape and data type of input
y = fluid.data(name='y', shape=[-1, 1], dtype='float32') # define shape and data type of output
x = fluid.layers.data(name='x', shape=[13], dtype='float32') # define shape and data type of input
y = fluid.layers.data(name='y', shape=[1], dtype='float32') # define shape and data type of output
y_predict = fluid.layers.fc(input=x, size=1, act=None) # fully connected layer connecting input and output

main_program = fluid.default_main_program() # get default/global main function
Expand Down
4 changes: 2 additions & 2 deletions 01.fit_a_line/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ def main():
batch_size=batch_size)

# feature vector of length 13
x = fluid.data(name='x', shape=[-1, 13], dtype='float32')
y = fluid.data(name='y', shape=[-1, 1], dtype='float32')
x = fluid.layers.data(name='x', shape=[13], dtype='float32')
y = fluid.layers.data(name='y', shape=[1], dtype='float32')

main_program = fluid.default_main_program()
startup_program = fluid.default_startup_program()
Expand Down