27 #ifndef LBANN_LAYER_SORT_HPP_INCLUDED 28 #define LBANN_LAYER_SORT_HPP_INCLUDED 33 #include "lbann/proto/layers.pb.h" 38 template <
typename TensorDataType,
44 "sort layer only supports DATA_PARALLEL");
59 template <
typename ArchiveT>
64 std::string
get_type()
const override {
return "sort"; }
86 void setup_data(
size_t max_mini_batch_size)
override;
104 template <
typename T, data_layout L, El::Device D>
107 proto.set_datatype(proto::ProtoDataType<T>);
108 auto* msg = proto.mutable_sort();
112 #ifndef LBANN_SORT_LAYER_INSTANTIATE 113 #define PROTO_DEVICE(T, Device) \ 114 extern template class sort_layer<T, data_layout::DATA_PARALLEL, Device> 118 #endif // LBANN_SORT_LAYER_INSTANTIATE 122 #endif // LBANN_LAYER_SORT_HPP_INCLUDED
friend class cereal::access
std::string get_type() const override
Get the layer type's name.
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...
void write_specific_proto(lbann_data::Layer &proto) const final
void fp_setup_outputs() override
Setup output tensors. Called by the 'forward_prop' function. Each output tensor is resized to match t...
Generates nicely formatted description messages.
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
virtual description get_description() const
Human-readable description.
constexpr El::Device Device
sort_layer & operator=(const sort_layer &other)
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
sort_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.
El::Device get_device_allocation() const override
Get the device allocation for the data tensors. We assume that the decice allocation of the previous ...
data_layout
Data layout that is optimized for different modes of parallelism.
description get_description() const override
Human-readable description.
sort_layer(lbann_comm *comm, bool descending=false)
void serialize(ArchiveT &ar)
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.
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 setup_data(size_t max_mini_batch_size) override
Setup layer data. Called by the 'setup' function. Memory is allocated for distributed matrices...
std::unique_ptr< El::AbstractMatrix< El::Int > > m_indices