File tree Expand file tree Collapse file tree 2 files changed +4
-26
lines changed
python/paddle/fluid/layers Expand file tree Collapse file tree 2 files changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -414,34 +414,12 @@ Tensor* GetMutableLoDTensorOrSelectedRowsValueFromVar(Variable* var) {
414
414
}
415
415
416
416
bool ExecutionContext::HasInput (const std::string& name) const {
417
- if (!op_.HasInputs (name)) {
418
- return false ;
419
- }
420
- auto & ins = Inputs (name);
421
- size_t length = ins.size ();
422
- if (length == 0 ) {
423
- return false ;
424
- }
425
- PADDLE_ENFORCE_EQ (length, 1UL ,
426
- " Input %s should not have more than one inputs" , name);
427
- auto arg = ins[0 ];
428
- auto * var = arg == kEmptyVarName ? nullptr : scope_.FindVar (arg);
417
+ auto * var = InputVar (name);
429
418
return var != nullptr ;
430
419
}
431
420
432
421
bool ExecutionContext::HasOutput (const std::string& name) const {
433
- if (!op_.HasOutputs (name)) {
434
- return false ;
435
- }
436
- auto & outs = Outputs (name);
437
- size_t length = outs.size ();
438
- if (length == 0 ) {
439
- return false ;
440
- }
441
- PADDLE_ENFORCE_EQ (length, 1UL ,
442
- " Output %s should not have more than one inputs" , name);
443
- auto arg = outs[0 ];
444
- auto * var = arg == kEmptyVarName ? nullptr : scope_.FindVar (arg);
422
+ auto * var = OutputVar (name);
445
423
return var != nullptr ;
446
424
}
447
425
Original file line number Diff line number Diff line change @@ -9011,8 +9011,8 @@ def get_attr_shape(list_shape):
9011
9011
actual_shape.stop_gradient = True
9012
9012
inputs["Shape"] = actual_shape
9013
9013
9014
- out = x if inplace else helper.create_variable_for_type_inference (
9015
- dtype=x.dtype)
9014
+ out = x if inplace and not in_dygraph_mode (
9015
+ ) else helper.create_variable_for_type_inference( dtype=x.dtype)
9016
9016
x_shape = helper.create_variable_for_type_inference(dtype=x.dtype)
9017
9017
helper.append_op(
9018
9018
type="reshape2",
You can’t perform that action at this time.
0 commit comments