未验证 提交 54a73578 编写于 作者: J Jiabin Yang 提交者: GitHub

Feature/install check (#16044)

* test=develop, add install check

* test=develop, add install check scripts

* test=develop, refine language

* test=develop, add api spec

* test=develop, change cdn to bj to pass ci
上级 99936514
......@@ -520,6 +520,7 @@ paddle.fluid.unique_name.guard (ArgSpec(args=['new_generator'], varargs=None, ke
paddle.fluid.recordio_writer.convert_reader_to_recordio_file (ArgSpec(args=['filename', 'reader_creator', 'feeder', 'compressor', 'max_num_records', 'feed_order'], varargs=None, keywords=None, defaults=(Compressor.Snappy, 1000, None)), ('document', '65c7523e86f0c50bb729b01667f36310'))
paddle.fluid.recordio_writer.convert_reader_to_recordio_files (ArgSpec(args=['filename', 'batch_per_file', 'reader_creator', 'feeder', 'compressor', 'max_num_records', 'feed_order'], varargs=None, keywords=None, defaults=(Compressor.Snappy, 1000, None)), ('document', 'bc643f0f5f1b9db57ff0d8a57d379bd7'))
paddle.fluid.Scope Scope() -> paddle.fluid.core._Scope
paddle.fluid.install_check.run_check (ArgSpec(args=[], varargs=None, keywords=None, defaults=None), ('document', '66b7c84a17ed32fec2df9628367be2b9'))
paddle.reader.cache (ArgSpec(args=['reader'], varargs=None, keywords=None, defaults=None), ('document', '1676886070eb607cb608f7ba47be0d3c'))
paddle.reader.map_readers (ArgSpec(args=['func'], varargs='readers', keywords=None, defaults=None), ('document', '77cbadb09df588e21e5cc0819b69c87d'))
paddle.reader.buffered (ArgSpec(args=['reader', 'size'], varargs=None, keywords=None, defaults=None), ('document', '0d6186f109feceb99f60ec50a0a624cb'))
......
......@@ -59,13 +59,14 @@ from .parallel_executor import *
from . import compiler
from .compiler import *
from paddle.fluid.layers.math_op_patch import monkey_patch_variable
from . import install_check
Tensor = LoDTensor
__all__ = framework.__all__ + executor.__all__ + \
trainer.__all__ + inferencer.__all__ + transpiler.__all__ + \
parallel_executor.__all__ + lod_tensor.__all__ + \
data_feed_desc.__all__ + async_executor.__all__ + compiler.__all__ + [
data_feed_desc.__all__ + async_executor.__all__ + compiler.__all__ + [
'io',
'initializer',
'layers',
......@@ -91,6 +92,7 @@ __all__ = framework.__all__ + executor.__all__ + \
'unique_name',
'recordio_writer',
'Scope',
'install_check',
]
......
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from .framework import Program, program_guard, unique_name, default_startup_program
from .param_attr import ParamAttr
from .initializer import Constant
from . import layers
from . import backward
from .imperative import Layer, nn
from . import executor
from . import core
import numpy as np
__all__ = ['run_check']
class SimpleLayer(Layer):
def __init__(self, name_scope):
super(SimpleLayer, self).__init__(name_scope)
self._fc1 = nn.FC(self.full_name(),
3,
ParamAttr(initializer=Constant(value=0.1)))
def forward(self, inputs):
x = self._fc1(inputs)
x = layers.reduce_sum(x)
return x
def run_check():
''' intall check to verify if install is success
This func should not be called only if you need to verify installation
'''
print("Running Verify Fluid Program ... ")
prog = Program()
startup_prog = Program()
scope = core.Scope()
with executor.scope_guard(scope):
with program_guard(prog, startup_prog):
with unique_name.guard():
np_inp = np.array([[1.0, 2.0], [3.0, 4.0]], dtype=np.float32)
inp = layers.data(
name="inp", shape=[2, 2], append_batch_size=False)
simple_layer = SimpleLayer("simple_layer")
out = simple_layer(inp)
param_grads = backward.append_backward(
out, parameter_list=[simple_layer._fc1._w.name])[0]
exe = executor.Executor(core.CPUPlace(
) if not core.is_compiled_with_cuda() else core.CUDAPlace(0))
exe.run(default_startup_program())
exe.run(feed={inp.name: np_inp},
fetch_list=[out.name, param_grads[1].name])
print(
"Your Paddle Fluid is installed successfully! Let's start deep Learning with Paddle Fluid now"
)
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import unittest
import paddle.fluid as fluid
class TestInstallCheck(unittest.TestCase):
def test_install_check(self):
fluid.install_check.run_check()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册