27 #ifndef LBANN_LAYERS_MISC_COVARIANCE_HPP_INCLUDED 28 #define LBANN_LAYERS_MISC_COVARIANCE_HPP_INCLUDED 33 #include "lbann/proto/layers.pb.h" 49 template <
typename TensorDataType, data_layout Layout, El::Device Device>
90 template <
typename ArchiveT>
95 std::string
get_type()
const override {
return "covariance"; }
118 void setup_data(
size_t max_mini_batch_size)
override;
135 template <
typename T, data_layout L, El::Device D>
137 lbann_data::Layer& proto)
const 139 proto.set_datatype(proto::ProtoDataType<T>);
140 auto* msg = proto.mutable_covariance();
144 #ifndef LBANN_COVARIANCE_LAYER_INSTANTIATE 145 #define PROTO_DEVICE(T, Device) \ 146 extern template class covariance_layer<T, \ 147 data_layout::DATA_PARALLEL, \ 149 extern template class covariance_layer<T, data_layout::MODEL_PARALLEL, Device> 153 #endif // LBANN_COVARIANCE_LAYER_INSTANTIATE 157 #endif // LBANN_LAYERS_MISC_COVARIANCE_HPP_INCLUDED covariance_layer(lbann_comm *comm, bool biased)
std::string get_type() const override
Get the layer type's name.
El::Device get_device_allocation() const override
Get the device allocation for the data tensors. We assume that the decice allocation of the previous ...
El::AbstractDistMatrix< TensorDataType > AbsDistMatrixType
The tensor type expected in this object.
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.
friend class cereal::access
covariance_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
void serialize(ArchiveT &ar)
Generates nicely formatted description messages.
data_layout get_data_layout() const override
Get data layout of the data tensors. We assume that the data layouts of the previous activations...
virtual description get_description() const
Human-readable description.
constexpr El::Device Device
covariance_layer(const covariance_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.
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...
std::unique_ptr< AbsDistMatrixType > m_means
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
std::unique_ptr< AbsDistMatrixType > m_workspace
void write_specific_proto(lbann_data::Layer &proto) const final
data_layout
Data layout that is optimized for different modes of parallelism.
void setup_data(size_t max_mini_batch_size) override
Setup layer data. Called by the 'setup' function. Memory is allocated for distributed matrices...
description get_description() const override
Human-readable description.
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
covariance_layer & operator=(const covariance_layer &other)
int m_expected_num_parent_layers
data_type_layer & operator=(data_type_layer &&other)=default