27 #ifndef LBANN_LAYERS_MISC_VARIANCE_HPP_INCLUDED 28 #define LBANN_LAYERS_MISC_VARIANCE_HPP_INCLUDED 33 #include "lbann/proto/layers.pb.h" 48 template <
typename TensorDataType, data_layout Layout, El::Device Device>
84 template <
typename ArchiveT>
89 std::string
get_type()
const override {
return "variance"; }
112 void setup_data(
size_t max_mini_batch_size)
override;
129 template <
typename T, data_layout L, El::Device D>
131 lbann_data::Layer& proto)
const 133 proto.set_datatype(proto::ProtoDataType<T>);
134 auto* msg = proto.mutable_variance();
138 #ifndef LBANN_VARIANCE_LAYER_INSTANTIATE 139 #define PROTO_DEVICE(T, Device) \ 140 extern template class variance_layer<T, data_layout::DATA_PARALLEL, Device>; \ 141 extern template class variance_layer<T, data_layout::MODEL_PARALLEL, Device> 145 #endif // LBANN_VARIANCE_LAYER_INSTANTIATE 149 #endif // LBANN_LAYERS_MISC_VARIANCE_HPP_INCLUDED description get_description() const override
Human-readable description.
El::Device get_device_allocation() const override
Get the device allocation for the data tensors. We assume that the decice allocation of the previous ...
std::unique_ptr< AbsDistMatrixType > m_workspace
data_layout get_data_layout() const override
Get data layout of the data tensors. We assume that the data layouts of the previous activations...
void serialize(ArchiveT &ar)
variance_layer(const variance_layer &other)
Generates nicely formatted description messages.
void write_specific_proto(lbann_data::Layer &proto) const final
virtual description get_description() const
Human-readable description.
friend class cereal::access
constexpr El::Device Device
variance_layer & operator=(const variance_layer &other)
void setup_dims() override
Setup tensor dimensions Called by the 'setup' function. If there are any input tensors, the base method sets all uninitialized output tensor dimensions equal to the first input tensor dimensions.
std::string get_type() const override
Get the layer type's name.
variance_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
void fp_compute() override
Apply layer operation. Called by the 'forward_prop' function. Given the input tensors, the output tensors are populated with computed values.
variance_layer(lbann_comm *comm, bool biased)
void setup_data(size_t max_mini_batch_size) override
Setup layer data. Called by the 'setup' function. Memory is allocated for distributed matrices...
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
data_layout
Data layout that is optimized for different modes of parallelism.
std::unique_ptr< AbsDistMatrixType > m_means
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
El::AbstractDistMatrix< TensorDataType > AbsDistMatrixType
The tensor type expected in this object.
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...
data_type_layer & operator=(data_type_layer &&other)=default