27 #ifndef LBANN_LAYERS_LOSS_L1_NORM_HPP_INCLUDED 28 #define LBANN_LAYERS_LOSS_L1_NORM_HPP_INCLUDED 32 #include "lbann/proto/layers.pb.h" 40 template <
typename TensorDataType, data_layout T_layout, El::Device Dev>
71 template <
typename ArchiveT>
76 std::string
get_type()
const override {
return "L1 norm"; }
97 dist.colDist = El::STAR;
98 m_workspace.reset(AbsDistMatrixType::Instantiate(dist));
99 #ifdef HYDROGEN_HAVE_CUB 100 if (
m_workspace->GetLocalDevice() == El::Device::GPU) {
103 #endif // HYDROGEN_HAVE_CUB 127 #ifndef LBANN_L1_NORM_LAYER_INSTANTIATE 129 #define PROTO_DEVICE(T, Device) \ 130 extern template class l1_norm_layer<T, data_layout::DATA_PARALLEL, Device>; \ 131 extern template class l1_norm_layer<T, data_layout::MODEL_PARALLEL, Device> 136 #endif // LBANN_L1_NORM_LAYER_INSTANTIATE 140 #endif // LBANN_LAYERS_LOSS_L1_NORM_HPP_INCLUDED
El::AbstractDistMatrix< TensorDataType > AbsDistMatrixType
The tensor type expected in this object.
virtual void setup_dims()
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 setup_data(size_t max_mini_batch_size) override
Setup layer data. Called by the 'setup' function. Memory is allocated for distributed matrices...
El::Device get_device_allocation() const override
Get the device allocation for the data tensors. We assume that the decice allocation of the previous ...
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
std::unique_ptr< AbsDistMatrixType > m_workspace
std::string get_type() const override
Get the layer type's name.
constexpr El::Device Device
l1_norm_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
InputAbsDistMatrixType & get_prev_activations(int parent_index=0)
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
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 set_output_dims(std::vector< int > dims, size_t output_index=0)
Set output tensor dimensions.
l1_norm_layer(lbann_comm *comm)
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.
void write_specific_proto(lbann_data::Layer &proto) const final
data_layout get_data_layout() const override
Get data layout of the data tensors. We assume that the data layouts of the previous activations...
data_layout
Data layout that is optimized for different modes of parallelism.
l1_norm_layer & operator=(const l1_norm_layer &other)
l1_norm_layer(const l1_norm_layer &other)
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...
void setup_data(size_t max_mini_batch_size) override
friend class cereal::access
data_type_layer & operator=(data_type_layer &&other)=default
void serialize(ArchiveT &ar)