27 #ifndef LBANN_LAYERS_REGULARIZERS_CHANNELWISE_SOFTMAX_HPP_INCLUDED 28 #define LBANN_LAYERS_REGULARIZERS_CHANNELWISE_SOFTMAX_HPP_INCLUDED 33 #include "lbann/proto/layers.pb.h" 50 template <
typename TensorDataType, data_layout Layout, El::Device Device>
54 "channelwise_softmax_layer only supports " 55 "data-parallel data layout");
60 bool single_dim_mode);
70 template <
typename ArchiveT>
75 std::string
get_type()
const override;
98 El::Int& channel_stride,
99 El::Int& num_channels)
const;
115 template <
typename T, data_layout L, El::Device D>
117 lbann_data::Layer& proto)
const 119 proto.set_datatype(proto::ProtoDataType<T>);
120 auto* msg = proto.mutable_channelwise_softmax();
125 template <
typename TensorDataType, data_layout Layout, El::Device Device>
133 template <
typename TensorDataType, data_layout Layout, El::Device Device>
140 template <
typename TensorDataType, data_layout Layout, El::Device Device>
144 return "channel-wise softmax";
147 template <
typename TensorDataType, data_layout Layout, El::Device Device>
155 template <
typename TensorDataType, data_layout Layout, El::Device Device>
166 #ifndef LBANN_CHANNELWISE_SOFTMAX_LAYER_INSTANTIATE 167 #define PROTO_DEVICE(T, Device) \ 168 extern template class channelwise_softmax_layer<T, \ 169 data_layout::DATA_PARALLEL, \ 173 #endif // LBANN_CHANNELWISE_SOFTMAX_LAYER_INSTANTIATE 177 #endif // LBANN_LAYERS_REGULARIZERS_CHANNELWISE_SOFTMAX_HPP_INCLUDED
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...
bool m_single_dim_mode
If true, only performs softmax on the chosen dimension. Otherwise all dimensions but m_dim will be us...
void get_channel_size_and_stride(El::Int &channel_size, El::Int &channel_stride, El::Int &num_channels) const
channelwise_softmax_layer & operator=(const channelwise_softmax_layer &other)=default
void write_specific_proto(lbann_data::Layer &proto) const final
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 ...
constexpr El::Device Device
Apply softmax to tensor channels.
channelwise_softmax_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
channelwise_softmax_layer()
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 fp_compute() override
Apply layer operation. Called by the 'forward_prop' function. Given the input tensors, the output tensors are populated with computed values.
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
friend class cereal::access
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.
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)