refine code

revert-4814-Add_sequence_project_op
qijun 7 years ago
parent 701c90f6f7
commit 5fe3f8f630

@ -37,9 +37,9 @@ void SetFeedVariable(const LoDTensor& input, const std::string& var_name,
} }
LoDTensor& GetFetchVariable(const std::string& var_name, size_t index) { LoDTensor& GetFetchVariable(const std::string& var_name, size_t index) {
// If var_name Variable is not found in GlobalScope, a new variable will // Since we want to fetch LodTensor from a variable, the variable must
// be created. // be created alreadly.
Variable* g_fetch_value = GetGlobalScope().Var(var_name); Variable* g_fetch_value = GetGlobalScope().FindVar(var_name);
auto& fetch_outputs = auto& fetch_outputs =
*(g_fetch_value->GetMutable<std::vector<paddle::framework::LoDTensor>>()); *(g_fetch_value->GetMutable<std::vector<paddle::framework::LoDTensor>>());
PADDLE_ENFORCE_LT(index, fetch_outputs.size()); PADDLE_ENFORCE_LT(index, fetch_outputs.size());

@ -12,7 +12,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "paddle/pybind/pybind.h" #include "paddle/pybind/protobuf.h"
#include "paddle/framework/backward.h" #include "paddle/framework/backward.h"
#include "paddle/framework/executor.h" #include "paddle/framework/executor.h"
#include "paddle/framework/feed_fetch_method.h" #include "paddle/framework/feed_fetch_method.h"
@ -25,7 +26,7 @@ limitations under the License. */
#include "paddle/platform/enforce.h" #include "paddle/platform/enforce.h"
#include "paddle/platform/place.h" #include "paddle/platform/place.h"
#include "paddle/pybind/exception.h" #include "paddle/pybind/exception.h"
#include "paddle/pybind/protobuf.h" #include "paddle/pybind/pybind.h"
#include "paddle/pybind/tensor_py.h" #include "paddle/pybind/tensor_py.h"
#include "paddle/string/to_string.h" #include "paddle/string/to_string.h"

Loading…
Cancel
Save