27 #ifndef LBANN_LAYERS_REGULARIZERS_INSTANCE_NORM_HPP_INCLUDED 28 #define LBANN_LAYERS_REGULARIZERS_INSTANCE_NORM_HPP_INCLUDED 32 #include "lbann/proto/layers.pb.h" 51 template <
typename TensorDataType, data_layout Layout, El::Device Device>
55 "instance norm layer only supports data parallel layout");
67 std::string
get_type()
const override;
80 template <
typename ArchiveT>
109 template <
typename T, data_layout L, El::Device D>
111 lbann_data::Layer& proto)
const 113 proto.set_datatype(proto::ProtoDataType<T>);
114 auto* msg = proto.mutable_instance_norm();
115 msg->mutable_epsilon()->set_value(
m_epsilon);
118 template <
typename TensorDataType, data_layout Layout, El::Device Device>
120 TensorDataType epsilon)
124 template <
typename TensorDataType, data_layout Layout, El::Device Device>
131 template <
typename TensorDataType, data_layout Layout, El::Device Device>
135 return "instance norm";
138 template <
typename TensorDataType, data_layout Layout, El::Device Device>
145 template <
typename TensorDataType, data_layout Layout, El::Device Device>
153 template <
typename TensorDataType, data_layout Layout, El::Device Device>
162 template <
typename TensorDataType, data_layout Layout, El::Device Device>
173 #ifndef LBANN_INSTANCE_NORM_LAYER_INSTANTIATE 174 #define PROTO_DEVICE(T, Device) \ 175 extern template class instance_norm_layer<T, \ 176 data_layout::DATA_PARALLEL, \ 180 #endif // LBANN_INSTANCE_NORM_LAYER_INSTANTIATE 184 #endif // LBANN_LAYERS_REGULARIZERS_INSTANCE_NORM_HPP_INCLUDED void write_specific_proto(lbann_data::Layer &proto) const final
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.
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
instance_norm_layer & operator=(const instance_norm_layer &other)=default
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.
std::vector< int > get_input_dims(size_t input_index=0) const
Get input tensor dimensions.
Generates nicely formatted description messages.
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.
virtual description get_description() const
Human-readable description.
constexpr El::Device Device
void set_output_dims(std::vector< int > dims, size_t output_index=0)
Set output tensor dimensions.
instance_norm_layer(TensorDataType epsilon=El::To< TensorDataType >(1e-5))
El::Device get_device_allocation() const override
Get the device allocation for the data tensors. We assume that the decice allocation of the previous ...
El::Matrix< TensorDataType, Device > m_workspace
std::string get_type() const override
Get the layer type's name.
Normalize over data channels.
data_layout
Data layout that is optimized for different modes of parallelism.
description get_description() const override
Human-readable description.
data_layout get_data_layout() const override
Get data layout of the data tensors. We assume that the data layouts of the previous activations...
instance_norm_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
LBANN_DEFINE_LAYER_BUILDER(elu)
void serialize(ArchiveT &ar)
void bp_compute() override
Compute objective funciton gradients. Called by the 'back_prop' function. Given the input...