Skip to content

Commit cfc02d2

Browse files
authored
Merge pull request #12200 from panyx0718/api
hide more apis
2 parents 4a07617 + e147e58 commit cfc02d2

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

paddle/fluid/API.spec

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,6 @@ paddle.fluid.layers.relu ArgSpec(args=['x'], varargs=None, keywords=None, defaul
179179
paddle.fluid.layers.log ArgSpec(args=['x'], varargs=None, keywords=None, defaults=None)
180180
paddle.fluid.layers.crop ArgSpec(args=['x', 'shape', 'offsets', 'name'], varargs=None, keywords=None, defaults=(None, None, None))
181181
paddle.fluid.layers.data ArgSpec(args=['name', 'shape', 'append_batch_size', 'dtype', 'lod_level', 'type', 'stop_gradient'], varargs=None, keywords=None, defaults=(True, 'float32', 0, VarType.LOD_TENSOR, True))
182-
paddle.fluid.layers.BlockGuardServ.__init__ ArgSpec(args=['self', 'server'], varargs=None, keywords=None, defaults=None)
183-
paddle.fluid.layers.ListenAndServ.__init__ ArgSpec(args=['self', 'endpoint', 'inputs', 'fan_in', 'optimizer_mode'], varargs=None, keywords=None, defaults=(1, True))
184-
paddle.fluid.layers.ListenAndServ.complete_op ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
185-
paddle.fluid.layers.ListenAndServ.do ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
186-
paddle.fluid.layers.ListenAndServ.get_params_and_grads ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
187-
paddle.fluid.layers.ListenAndServ.parent_block ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
188-
paddle.fluid.layers.Send ArgSpec(args=['endpoints', 'send_vars', 'sync'], varargs=None, keywords=None, defaults=(True,))
189-
paddle.fluid.layers.Recv ArgSpec(args=['endpoints', 'get_vars', 'sync'], varargs=None, keywords=None, defaults=(True,))
190182
paddle.fluid.layers.open_recordio_file ArgSpec(args=['filename', 'shapes', 'lod_levels', 'dtypes', 'pass_num', 'for_parallel'], varargs=None, keywords=None, defaults=(1, True))
191183
paddle.fluid.layers.open_files ArgSpec(args=['filenames', 'shapes', 'lod_levels', 'dtypes', 'thread_num', 'buffer_size', 'pass_num', 'for_parallel'], varargs=None, keywords=None, defaults=(1, None, 1, True))
192184
paddle.fluid.layers.read_file ArgSpec(args=['reader'], varargs=None, keywords=None, defaults=None)
@@ -198,7 +190,6 @@ paddle.fluid.layers.py_reader ArgSpec(args=['capacity', 'shapes', 'dtypes', 'lod
198190
paddle.fluid.layers.Preprocessor.__init__ ArgSpec(args=['self', 'reader', 'name'], varargs=None, keywords=None, defaults=(None,))
199191
paddle.fluid.layers.Preprocessor.block ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None)
200192
paddle.fluid.layers.Preprocessor.inputs ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
201-
paddle.fluid.layers.Preprocessor.is_completed ArgSpec(args=['self'], varargs=None, keywords=None, defaults=None)
202193
paddle.fluid.layers.Preprocessor.outputs ArgSpec(args=['self'], varargs='outs', keywords=None, defaults=None)
203194
paddle.fluid.layers.load ArgSpec(args=['out', 'file_path', 'load_as_fp16'], varargs=None, keywords=None, defaults=(None,))
204195
paddle.fluid.layers.create_tensor ArgSpec(args=['dtype', 'name', 'persistable'], varargs=None, keywords=None, defaults=(None, False))

python/paddle/fluid/layers/io.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
from layer_function_generator import generate_layer_fn, templatedoc
2323

2424
__all__ = [
25-
'data', 'BlockGuardServ', 'ListenAndServ', 'Send', 'Recv',
26-
'open_recordio_file', 'open_files', 'read_file', 'shuffle', 'batch',
25+
'data', 'open_recordio_file', 'open_files', 'read_file', 'shuffle', 'batch',
2726
'double_buffer', 'random_data_generator', 'py_reader', 'Preprocessor',
2827
'load'
2928
]
@@ -802,7 +801,7 @@ def __init__(self, reader, name=None):
802801
self.sink_var_names = None
803802
self.status = Preprocessor.BEFORE_SUB_BLOCK
804803

805-
def is_completed(self):
804+
def _is_completed(self):
806805
return self.sub_block and self.source_var_names and self.sink_var_names
807806

808807
@contextlib.contextmanager
@@ -812,7 +811,7 @@ def block(self):
812811
yield
813812
self.main_prog.rollback()
814813
self.status = Preprocessor.AFTER_SUB_BLOCK
815-
if not self.is_completed():
814+
if not self._is_completed():
816815
raise RuntimeError(
817816
"The definition of preprocessor is incompleted! "
818817
"Please make sure that you have set input and output "

python/paddle/fluid/tests/unittests/test_dist_train.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
import paddle.fluid as fluid
2424
import paddle.fluid.layers as layers
25+
from paddle.fluid.layers.io import ListenAndServ
26+
from paddle.fluid.layers.io import Recv
27+
from paddle.fluid.layers.io import Send
2528

2629

2730
class TestSendOp(unittest.TestCase):
@@ -65,8 +68,7 @@ def init_serv(self, place):
6568
main = fluid.Program()
6669

6770
with fluid.program_guard(main):
68-
serv = layers.ListenAndServ(
69-
"127.0.0.1:0", ["X"], optimizer_mode=False)
71+
serv = ListenAndServ("127.0.0.1:0", ["X"], optimizer_mode=False)
7072
with serv.do():
7173
out_var = main.global_block().create_var(
7274
name="scale_0.tmp_0",
@@ -99,8 +101,8 @@ def init_client(self, place, port):
99101
persistable=False,
100102
shape=[32, 32])
101103
fluid.initializer.Constant(value=2.3)(get_var, main.global_block())
102-
layers.Send("127.0.0.1:%d" % port, [x])
103-
o = layers.Recv("127.0.0.1:%d" % port, [get_var])
104+
Send("127.0.0.1:%d" % port, [x])
105+
o = Recv("127.0.0.1:%d" % port, [get_var])
104106

105107
exe = fluid.Executor(place)
106108
self.dist_out = exe.run(main, fetch_list=o) # o is a list

0 commit comments

Comments
 (0)