未验证 提交 a63e2a0a 编写于 作者: X Xin Pan 提交者: GitHub

Merge pull request #15948 from panyx0718/api2

Add deprecation warning
...@@ -432,8 +432,8 @@ function assert_api_spec_approvals() { ...@@ -432,8 +432,8 @@ function assert_api_spec_approvals() {
BRANCH="develop" BRANCH="develop"
fi fi
API_FILES=("cmake/external" API_FILES=("paddle/fluid/API.spec"
"paddle/fluid/API.spec" "python/paddle/fluid/parallel_executor.py"
"paddle/fluid/framework/operator.h" "paddle/fluid/framework/operator.h"
"paddle/fluid/framework/tensor.h" "paddle/fluid/framework/tensor.h"
"paddle/fluid/framework/lod_tensor.h" "paddle/fluid/framework/lod_tensor.h"
......
...@@ -92,6 +92,11 @@ class ParallelExecutor(object): ...@@ -92,6 +92,11 @@ class ParallelExecutor(object):
num_trainers=1, num_trainers=1,
trainer_id=0, trainer_id=0,
scope=None): scope=None):
sys.stderr.write(
'ParallelExecutor is deprecated. '
'Please use CompiledProgram and Executor. CompiledProgram '
'is a central place for optimization and Executor is the '
'unified executor. Example can be found in compiler.py.\n')
# step1: get places, the places are used in run too. # step1: get places, the places are used in run too.
self._places = [] self._places = []
if use_cuda: if use_cuda:
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
from __future__ import print_function from __future__ import print_function
import os import os
import sys
import numpy as np import numpy as np
from .. import core from .. import core
from ..framework import Program from ..framework import Program
...@@ -50,6 +51,9 @@ class InferenceTranspiler(object): ...@@ -50,6 +51,9 @@ class InferenceTranspiler(object):
place (Place): inference place place (Place): inference place
scope (Scope|None): inference Scope scope (Scope|None): inference Scope
''' '''
sys.stderr.write("InferenceTranspiler is deprecated since it's not "
"safe. Users should be "
"responsible for constructing the inference program\n")
if not isinstance(program, Program): if not isinstance(program, Program):
raise TypeError("program should be as Program type") raise TypeError("program should be as Program type")
if not isinstance(place, core.CPUPlace) and not isinstance( if not isinstance(place, core.CPUPlace) and not isinstance(
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
from __future__ import print_function from __future__ import print_function
import six import six
import sys
from collections import defaultdict, MutableSet from collections import defaultdict, MutableSet
from .. import core from .. import core
from ... import compat as cpt from ... import compat as cpt
...@@ -509,6 +510,8 @@ def memory_optimize(input_program, ...@@ -509,6 +510,8 @@ def memory_optimize(input_program,
Returns: Returns:
None None
""" """
sys.stderr.write('memory_optimize is deprecated. '
'Use CompiledProgram and Executor\n')
def to_name_str(var): def to_name_str(var):
if isinstance(var, Variable): if isinstance(var, Variable):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册