27 #ifndef LBANN_LAYERS_MISC_CHANNELWISE_MEAN_HPP_INCLUDED 28 #define LBANN_LAYERS_MISC_CHANNELWISE_MEAN_HPP_INCLUDED 33 #include "lbann/proto/layers.pb.h" 38 template <
typename TensorDataType,
44 "channelwise_mean_layer only supports " 45 "data-parallel data layout");
60 template <
typename ArchiveT>
65 std::string
get_type()
const override {
return "channel-wise mean"; }
86 template <
typename T, data_layout L, El::Device D>
88 lbann_data::Layer& proto)
const 90 proto.set_datatype(proto::ProtoDataType<T>);
91 proto.mutable_channelwise_mean();
94 #ifndef LBANN_CHANNELWISE_MEAN_LAYER_INSTANTIATE 95 #define PROTO_DEVICE(T, Device) \ 96 extern template class channelwise_mean_layer<T, \ 97 data_layout::DATA_PARALLEL, \ 102 #endif // LBANN_CHANNELWISE_MEAN_LAYER_INSTANTIATE 106 #endif // LBANN_LAYERS_MISC_CHANNELWISE_MEAN_HPP_INCLUDED El::Device get_device_allocation() const override
Get the device allocation for the data tensors. We assume that the decice allocation of the previous ...
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 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...
std::vector< int > get_input_dims(size_t input_index=0) const
Get 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.
constexpr El::Device Device
channelwise_mean_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
void set_output_dims(std::vector< int > dims, size_t output_index=0)
Set output tensor dimensions.
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
std::string get_type() const override
Get the layer type's name.
data_layout
Data layout that is optimized for different modes of parallelism.
void serialize(ArchiveT &ar)
channelwise_mean_layer(lbann_comm *=nullptr)
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.
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.