LBANN  0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
layer_term.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_OBJECTIVE_FUNCTION_LAYER_TERM_HPP_INCLUDED
28 #define LBANN_OBJECTIVE_FUNCTION_LAYER_TERM_HPP_INCLUDED
29 
32 
33 namespace lbann {
34 
36 {
37 public:
38  layer_term(EvalType scale_factor = EvalType(1));
39  layer_term* copy() const override { return new layer_term(*this); }
40  std::string name() const override { return "evaluation layer term"; }
41 
43  void set_layer(ViewingLayerPtr l);
45  Layer& get_layer();
47  const Layer& get_layer() const;
48 
49  void setup(model& m) override;
50 
51  void start_evaluation() override;
52 
53  EvalType finish_evaluation() override;
54 
55  void differentiate() override;
56 
57  void compute_weight_regularization() override{};
58 
59  template <typename ArchiveT>
60  void serialize(ArchiveT& ar);
61 
62 private:
64  void write_specific_proto(lbann_data::ObjectiveFunction& proto) const final;
65 
67  /*abstract_evaluation_*/ Layer& get_evaluation_layer();
68 };
69 
70 } // namespace lbann
71 
72 #endif // LBANN_OBJECTIVE_FUNCTION_LAYER_TERM_HPP_INCLUDED
void set_layer(ViewingLayerPtr l)
layer_term(EvalType scale_factor=EvalType(1))
void serialize(ArchiveT &ar)
std::weak_ptr< Layer > ViewingLayerPtr
Smart pointer to reference a layer object.
Definition: layer.hpp:133
void start_evaluation() override
Neural network tensor operation.
Definition: layer.hpp:285
Layer & get_layer()
Abstract base class for neural network models.
Definition: model.hpp:83
void write_specific_proto(lbann_data::ObjectiveFunction &proto) const final
Add objective function data to prototext.
layer_term * copy() const override
Definition: layer_term.hpp:39
void setup(model &m) override
Layer & get_evaluation_layer()
void compute_weight_regularization() override
Definition: layer_term.hpp:57
EvalType finish_evaluation() override
void differentiate() override
double EvalType
Definition: base.hpp:189
std::string name() const override
Definition: layer_term.hpp:40