Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Paddle
Commits
c0e3fa40
"git@developer.sourcefind.cn:change/sglang.git" did not exist on "e5888eddda68eef76468d4d092577eb79c295b87"
Commit
c0e3fa40
authored
May 05, 2023
by
yuguo960516yuguo
Browse files
gitignore
parent
de2e6515
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
143 additions
and
45 deletions
+143
-45
paddle/fluid/eager/api/generated/eager_generated/forwards/scale.cc
...uid/eager/api/generated/eager_generated/forwards/scale.cc
+99
-0
paddle/fluid/eager/api/generated/eager_generated/forwards/scale.h
...luid/eager/api/generated/eager_generated/forwards/scale.h
+26
-0
paddle/fluid/framework/.gitignore
paddle/fluid/framework/.gitignore
+0
-2
paddle/fluid/inference/api/demo_ci/.gitignore
paddle/fluid/inference/api/demo_ci/.gitignore
+0
-1
paddle/fluid/pybind/.gitignore
paddle/fluid/pybind/.gitignore
+0
-11
paddle/infrt/api/.gitignore
paddle/infrt/api/.gitignore
+0
-1
paddle/infrt/tests/.gitignore
paddle/infrt/tests/.gitignore
+0
-7
paddle/infrt/tests/dialect/tensor/.gitignore
paddle/infrt/tests/dialect/tensor/.gitignore
+0
-5
python/.gitignore
python/.gitignore
+0
-9
python/paddle/.gitignore
python/paddle/.gitignore
+0
-1
python/paddle/fluid/.gitignore
python/paddle/fluid/.gitignore
+0
-2
python/paddle/fluid/tests/.gitignore
python/paddle/fluid/tests/.gitignore
+0
-4
python/paddle/fluid/tests/book/.gitignore
python/paddle/fluid/tests/book/.gitignore
+0
-1
python/paddle/proto/__init__.py
python/paddle/proto/__init__.py
+18
-0
tools/codestyle/.gitignore
tools/codestyle/.gitignore
+0
-1
No files found.
paddle/fluid/eager/api/generated/eager_generated/forwards/scale.cc
0 → 100644
View file @
c0e3fa40
// Copyright (c) 2021 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.
/**
* This File should be automatically generated by coding auto generator.
* All ops C++ autograd logic is defined here, in Python-C extension API
* system we try to avoid any autograd related code, and move them all to
* here.
*
* Currently, we just manually do some fwd autograd here. And we will replace
* them with auto code generator later.
* **/
#include "paddle/fluid/eager/api/generated/eager_generated/forwards/scale.h"
#include "paddle/fluid/eager/api/generated/eager_generated/backwards/scale_node.h"
#include "paddle/fluid/eager/autograd_meta.h"
#include "paddle/fluid/eager/eager_tensor.h"
#include "paddle/fluid/eager/utils.h"
#include "paddle/phi/api/all.h"
namespace
egr
{
paddle
::
experimental
::
Tensor
scale
(
const
paddle
::
experimental
::
Tensor
&
x
,
float
scale
,
float
bias
,
bool
bias_after_scale
,
bool
trace_backward
)
{
// 1. Run Forward
// 1.1 Create outputs
paddle
::
experimental
::
Tensor
out
;
// 1.2 Need by original op, we assemble ins, outs, attrs here
// 1.3 Call forward C++ api
ScaleAPI
(
x
,
scale
,
bias
,
bias_after_scale
,
&
out
);
// 2. Build Backward Depends
// 2.1 Get AutogradMetas for all ins and outs
auto
p_autograd_in
=
EagerUtils
::
unsafe_autograd_meta
(
x
);
// NOTE: Call EagerUtils::multi_autograd_meta when we have vector of outputs
auto
p_autograd_out
=
EagerUtils
::
autograd_meta
(
&
out
);
// 2.2 Add GradNode
// 2.2.1 ComputeRequireGrad
// TODO(jiabin) : make this function accept different kinds of input
// TODO(zhanlve): which one is more efficient:
// 1. construct a vector of pointers
// 2. call "ComputeRequireGrad" multiple times
bool
require_any_grad
=
EagerUtils
::
ComputeRequireGrad
(
trace_backward
,
p_autograd_in
);
if
(
require_any_grad
)
{
EagerUtils
::
PassStopGradient
(
false
/*generate_grad*/
,
p_autograd_out
);
// 2.2.2 Set OutRankInfo for outputs this needs to be as same as Edges's
// input_rank_
/** Note:
// 1. We provide EagerUtils::SetMultiOutRank(vector<AutogradMeta*>),
// since we have some of Operator has servel slot name with duplicate
outputs.
// 2. We call AutogradMeta's SetOutput Rank only when we have single output
with
// single slot name.
**/
p_autograd_out
->
SetSingleOutRankWithSlot
(
0
,
0
);
// Init GradNode
auto
scale_node
=
std
::
make_shared
<
GradNodeScale
>
(
/* fwd_in_slot_num */
1
,
/* bwd_in_slot_num */
1
);
// Pass Attributes to GradNode
scale_node
->
SetAttributes_scale
(
scale
);
// Set TensorWrappers
scale_node
->
SetTensorWrappers_X
({
x
});
// Set Grad out rank as same as fwd input and set stop gradient to bwd
scale_node
->
SetGradOutMeta
(
x
,
/*slot id*/
0
);
// Set Grad out rank as same as fwd input and set stop gradient to bwd
scale_node
->
SetGradInMeta
(
out
,
/*slot id*/
0
);
// Set History for output set current Grad Node for
EagerUtils
::
SetHistory
(
p_autograd_out
,
scale_node
);
}
return
out
;
}
}
// namespace egr
paddle/fluid/eager/api/generated/eager_generated/forwards/scale.h
0 → 100644
View file @
c0e3fa40
// Copyright (c) 2021 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.
#pragma once
#include "paddle/fluid/eager/eager_tensor.h"
namespace
egr
{
paddle
::
experimental
::
Tensor
scale
(
const
paddle
::
experimental
::
Tensor
&
x
,
float
scale
,
float
bias
,
bool
bias_after_scale
,
bool
trace_backward
);
}
// namespace egr
paddle/fluid/framework/.gitignore
deleted
100644 → 0
View file @
de2e6515
.tensor_util.cu
.data_type_transform.cu
\ No newline at end of file
paddle/fluid/inference/api/demo_ci/.gitignore
deleted
100644 → 0
View file @
de2e6515
data
paddle/fluid/pybind/.gitignore
deleted
100644 → 0
View file @
de2e6515
pybind.h
op_function1.cc
op_function2.cc
op_function3.cc
op_function4.cc
op_function5.cc
op_function6.cc
op_function7.cc
op_function8.cc
eager_op_function.cc
eager_legacy_op_function.cc
paddle/infrt/api/.gitignore
deleted
100644 → 0
View file @
de2e6515
infrt_api_test.cc
paddle/infrt/tests/.gitignore
deleted
100644 → 0
View file @
de2e6515
.DS_Store
.idea
*.log
tmp/
Output
paddle/infrt/tests/dialect/tensor/.gitignore
deleted
100644 → 0
View file @
de2e6515
.DS_Store
.idea
*.log
tmp/
tensor_map.mlir
python/.gitignore
deleted
100644 → 0
View file @
de2e6515
*pyc
build
dist
paddlepaddle.egg-info
paddle.egg-info
paddlepaddle_gpu.egg-info
.idea
paddle/proto/*.py
paddle/proto/*.pyc
python/paddle/.gitignore
deleted
100644 → 0
View file @
de2e6515
version.py
python/paddle/fluid/.gitignore
deleted
100644 → 0
View file @
de2e6515
proto
core.so
python/paddle/fluid/tests/.gitignore
deleted
100644 → 0
View file @
de2e6515
image/
fit_a_line.model/
tmp
cuda_profiler.txt
python/paddle/fluid/tests/book/.gitignore
deleted
100644 → 0
View file @
de2e6515
*.inference.model
python/paddle/proto/__init__.py
0 → 100644
View file @
c0e3fa40
# Copyright (c) 2016 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
paddle.proto.TrainerConfig_pb2
import
OptimizationConfig
,
TrainerConfig
from
paddle.proto.ModelConfig_pb2
import
ModelConfig
__all__
=
[]
tools/codestyle/.gitignore
deleted
100644 → 0
View file @
de2e6515
*.pyc
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment