mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
Make grad name unique (#4788)
* Make grad name unique * Modify for review comment
This commit is contained in:
parent
afa89566d7
commit
5a8962d327
3 changed files with 6 additions and 6 deletions
|
|
@ -37,7 +37,7 @@ typedef std::vector<NodeDef> GradientDef;
|
|||
class GradientBuilderBase {
|
||||
public:
|
||||
GradientBuilderBase(const GradientGraphConfiguration& gradient_graph_config,
|
||||
const Graph* graph,
|
||||
Graph* graph,
|
||||
const Node* node,
|
||||
const std::unordered_set<std::string>& gradient_inputs,
|
||||
const std::unordered_set<std::string>& gradient_outputs,
|
||||
|
|
@ -217,13 +217,13 @@ class GradientBuilderBase {
|
|||
if (!name.empty()) {
|
||||
unique_prefix << name << "_Grad/";
|
||||
} else {
|
||||
unique_prefix << node_->OpType() << "_" << node_->Index() << "_Grad/";
|
||||
unique_prefix << graph_->GenerateNodeName(node_->OpType()) << "_Grad/";
|
||||
}
|
||||
return unique_prefix.str();
|
||||
}
|
||||
|
||||
const GradientGraphConfiguration& gradient_graph_config_;
|
||||
const Graph* graph_;
|
||||
Graph* graph_;
|
||||
const Node* node_;
|
||||
std::string unique_node_prefix_;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace onnxruntime {
|
|||
namespace training {
|
||||
|
||||
GradientDef GetGradientForOp(const GradientGraphConfiguration& gradient_graph_config,
|
||||
const Graph* graph,
|
||||
Graph* graph,
|
||||
const Node* node,
|
||||
const std::unordered_set<std::string>& output_args_need_grad,
|
||||
const std::unordered_set<std::string>& input_args_need_grad,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace training {
|
|||
|
||||
typedef GenericRegistry<GradientBuilderBase,
|
||||
const GradientGraphConfiguration&,
|
||||
const Graph*&, // graph
|
||||
Graph*&, // graph
|
||||
const Node*&, // node
|
||||
const std::unordered_set<std::string>&, // gradient_inputs
|
||||
const std::unordered_set<std::string>&, // gradient_outputs
|
||||
|
|
@ -35,7 +35,7 @@ class GradientBuilderRegistry : public GradientRegistryType {
|
|||
};
|
||||
|
||||
GradientDef GetGradientForOp(const GradientGraphConfiguration& gradient_graph_config,
|
||||
const Graph* graph,
|
||||
Graph* graph,
|
||||
const Node* node,
|
||||
const std::unordered_set<std::string>& output_args_need_grad,
|
||||
const std::unordered_set<std::string>& input_args_need_grad,
|
||||
|
|
|
|||
Loading…
Reference in a new issue