LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
factories.hpp
Go to the documentation of this file.
1 // Copyright (c) 2014-2023, Lawrence Livermore National Security, LLC.
3 // Produced at the Lawrence Livermore National Laboratory.
4 // Written by the LBANN Research Team (B. Van Essen, et al.) listed in
5 // the CONTRIBUTORS file. <lbann-dev@llnl.gov>
6 //
7 // LLNL-CODE-697807.
8 // All rights reserved.
9 //
10 // This file is part of LBANN: Livermore Big Artificial Neural Network
11 // Toolkit. For details, see http://software.llnl.gov/LBANN or
12 // https://github.com/LLNL/LBANN.
13 //
14 // Licensed under the Apache License, Version 2.0 (the "Licensee"); you
15 // may not use this file except in compliance with the License. You may
16 // obtain a copy of the License at:
17 //
18 // http://www.apache.org/licenses/LICENSE-2.0
19 //
20 // Unless required by applicable law or agreed to in writing, software
21 // distributed under the License is distributed on an "AS IS" BASIS,
22 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
23 // implied. See the License for the specific language governing
24 // permissions and limitations under the license.
26 
27 #ifndef LBANN_PROTO_FACTORIES_HPP_INCLUDED
28 #define LBANN_PROTO_FACTORIES_HPP_INCLUDED
29 
31 #include "lbann/layers/layer.hpp"
36 
37 #include <google/protobuf/message.h>
38 
39 #include <map>
40 #include <memory>
41 
42 namespace lbann_data {
43 class Layer;
44 class Model;
45 class ObjectiveFunction;
46 class Optimizer;
47 class Operator;
48 class Reader;
49 class Transform;
50 class Weights;
51 } // namespace lbann_data
52 
53 namespace lbann {
54 
55 // Forward declarations
56 class callback_base;
57 class Layer;
58 class lbann_summary;
59 class model;
60 class objective_function;
61 class optimizer;
62 class trainer;
63 class weights;
64 
65 namespace proto {
66 
68 std::unique_ptr<trainer>
69 construct_trainer(lbann_comm* comm, const lbann_data::Trainer& proto_trainer);
70 
72 std::unique_ptr<model> construct_model(lbann_comm* comm,
73  const lbann_data::Optimizer& proto_opt,
74  const lbann_data::Trainer& proto_trainer,
75  const lbann_data::Model& proto_model);
76 
78 std::vector<OwningLayerPtr>
79 construct_layer_graph(lbann_comm* comm,
80  const lbann_data::Trainer& proto_trainer,
81  const lbann_data::Model& proto_model);
82 
84 template <typename TensorDataType, data_layout layout, El::Device Dev>
85 std::unique_ptr<Layer> construct_layer(lbann_comm* comm,
86  const lbann_data::Layer& proto_layer);
87 
89 template <typename InputT, typename OutputT, El::Device D>
90 auto construct_operator(const lbann_data::Operator& proto_operator)
91  -> std::unique_ptr<Operator<InputT, OutputT, D>>;
92 
94 std::unique_ptr<weights>
95 construct_weights(lbann_comm* comm,
96  const lbann_data::Optimizer& proto_opt,
97  const lbann_data::Weights& proto_weights);
98 
100 std::unique_ptr<callback_base>
101 construct_callback(const google::protobuf::Message& proto_cb);
102 
104 std::unique_ptr<callback_base>
105 construct_callback(const google::protobuf::Message& proto_cb,
106  std::shared_ptr<lbann_summary> const& summarizer);
107 
112 std::unique_ptr<lbann_summary> construct_summarizer(lbann_comm* comm,
113  const lbann_data::Model& m);
114 
116 template <typename T>
117 std::unique_ptr<optimizer>
118 construct_optimizer(const lbann_data::Optimizer& proto_opt);
119 
121 std::unique_ptr<objective_function>
122 construct_objective_function(const lbann_data::ObjectiveFunction& proto_obj);
123 
125 std::unique_ptr<transform::transform>
126 construct_transform(const lbann_data::Transform& trans);
128 transform::transform_pipeline
129 construct_transform_pipeline(const lbann_data::Reader& data_reader);
130 
131 } // namespace proto
132 } // namespace lbann
133 
134 #endif // LBANN_PROTO_FACTORIES_HPP_INCLUDED
std::unique_ptr< optimizer > construct_optimizer(const lbann_data::Optimizer &proto_opt)
transform::transform_pipeline construct_transform_pipeline(const lbann_data::Reader &data_reader)
std::unique_ptr< model > construct_model(lbann_comm *comm, const lbann_data::Optimizer &proto_opt, const lbann_data::Trainer &proto_trainer, const lbann_data::Model &proto_model)
auto construct_operator(const lbann_data::Operator &proto_operator) -> std::unique_ptr< Operator< InputT, OutputT, D >>
std::unique_ptr< weights > construct_weights(lbann_comm *comm, const lbann_data::Optimizer &proto_opt, const lbann_data::Weights &proto_weights)
std::vector< OwningLayerPtr > construct_layer_graph(lbann_comm *comm, const lbann_data::Trainer &proto_trainer, const lbann_data::Model &proto_model)
std::unique_ptr< objective_function > construct_objective_function(const lbann_data::ObjectiveFunction &proto_obj)
std::unique_ptr< trainer > construct_trainer(lbann_comm *comm, const lbann_data::Trainer &proto_trainer)
std::unique_ptr< transform::transform > construct_transform(const lbann_data::Transform &trans)
std::unique_ptr< Layer > construct_layer(lbann_comm *comm, const lbann_data::Layer &proto_layer)
std::unique_ptr< callback_base > construct_callback(const google::protobuf::Message &proto_cb, std::shared_ptr< lbann_summary > const &summarizer)
std::unique_ptr< lbann_summary > construct_summarizer(lbann_comm *comm, const lbann_data::Model &m)