Skip to content

Unify the fluid imports into paddle.v2.fluid #5876

@reyoung

Description

@reyoung

The current imports of fluid is quite noisy. We could simplify them by adding imports in fluid/__init__.py

import paddle.v2 as paddle
import paddle.v2.fluid.core as core
import paddle.v2.fluid.framework as framework
import paddle.v2.fluid.layers as layers
from paddle.v2.fluid.executor import Executor
from paddle.v2.fluid.io import save_persistables, load_persistables
from paddle.v2.fluid.optimizer import SGDOptimizer

The user API could be

import paddle.v2.fluid as fluid

data = fluid.layers.data(...)
loss = fluid.layers.fc(data, ...)
adam = fluid.optimizers.Adam()
adam.minimize(loss)
exe = fluid.Executor(...)
exe.run(feed={...}, fetch=[...])

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions