// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #pragma once #include "orttraining/core/graph/optimizer_graph_builder.h" namespace onnxruntime { namespace training { class AllreduceOptimizerGraphBuilder : public OptimizerGraphBuilder { public: AllreduceOptimizerGraphBuilder( const OptimizerBuilderRegistry& opt_builder_registry, const OptimizerGraphConfig& opt_graph_config, const std::unordered_map& weight_names_to_opt_configs, std::unordered_map& updated_weight_names_map, std::unordered_map& weight_partition_info); protected: virtual Status BuildInternal( bool should_add_gradient_norm, bool should_add_gradient_finite_check, Graph& graph, GraphAugmenter::GraphDefs& graph_defs, std::vector& weight_argdefs, std::vector& gradient_argdefs, std::unordered_map>& weight_to_opt_mapping, OptimizerOutputKeyMap& optimizer_graph_outputs) override; }; } // namespace training } // namespace onnxruntime