27 #ifndef LBANN_LAYERS_MISC_ROWWISE_WEIGHTS_NORMS_HPP_INCLUDED 28 #define LBANN_LAYERS_MISC_ROWWISE_WEIGHTS_NORMS_HPP_INCLUDED 32 #include "lbann/proto/layers.pb.h" 53 template <
typename TensorDataType,
70 template <
typename ArchiveT>
75 std::string
get_type()
const override;
94 using LocalMat = El::Matrix<TensorDataType, Device>;
100 static void row_axpy(TensorDataType alpha,
107 template <
typename T, data_layout L, El::Device D>
109 lbann_data::Layer& proto)
const 111 proto.set_datatype(proto::ProtoDataType<T>);
112 proto.mutable_rowwise_weights_norms();
115 #ifndef LBANN_ROWWISE_WEIGHTS_NORMS_LAYER_INSTANTIATE 116 #define PROTO_DEVICE(T, Device) \ 117 extern template class rowwise_weights_norms_layer< \ 119 data_layout::DATA_PARALLEL, \ 121 extern template class rowwise_weights_norms_layer< \ 123 data_layout::MODEL_PARALLEL, \ 127 #endif // LBANN_ROWWISE_WEIGHTS_NORMS_LAYER_INSTANTIATE 131 #endif // LBANN_LAYERS_MISC_ROWWISE_WEIGHTS_NORMS_HPP_INCLUDED
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
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.
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::string get_type() const override
Get the layer type's name.
static void sqrt(LocalMat &mat)
constexpr El::Device Device
rowwise_weights_norms_layer & operator=(const rowwise_weights_norms_layer &other)=default
static void row_sqsums(const LocalMat &mat, LocalMat &row_sqsums)
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
data_layout get_data_layout() const override
Get data layout of the data tensors. We assume that the data layouts of the previous activations...
L2 norm of each row of a weights matrix.
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...
static void row_axpy(TensorDataType alpha, const LocalMat &a_vec, const LocalMat &x_mat, TensorDataType beta, LocalMat &y_mat)
void serialize(ArchiveT &ar)
data_layout
Data layout that is optimized for different modes of parallelism.
static void divide(LocalMat &numer, const LocalMat &denom)
El::Matrix< TensorDataType, Device > LocalMat
rowwise_weights_norms_layer()
rowwise_weights_norms_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
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 write_specific_proto(lbann_data::Layer &proto) const final