27 #ifndef LBANN_LAYER_GAUSSIAN_HPP_INCLUDED 28 #define LBANN_LAYER_GAUSSIAN_HPP_INCLUDED 37 template <
typename TensorDataType,
56 const std::vector<int>& dims,
57 TensorDataType mean = El::TypeTraits<TensorDataType>::Zero(),
58 TensorDataType stdev = El::TypeTraits<TensorDataType>::One(),
59 bool training_only =
false)
63 m_training_only(training_only)
73 template <
typename ArchiveT>
78 std::string
get_type()
const override {
return "Gaussian"; }
87 desc.add(
"Mean", m_mean);
88 desc.add(
"Standard deviation", m_stdev);
89 desc.add(
"Training only", m_training_only);
103 #ifndef LBANN_GAUSSIAN_LAYER_INSTANTIATE 104 #define PROTO_DEVICE(T, Device) \ 105 extern template class gaussian_layer<T, data_layout::DATA_PARALLEL, Device>; \ 106 extern template class gaussian_layer<T, data_layout::MODEL_PARALLEL, Device> 110 #endif // LBANN_GAUSSIAN_LAYER_INSTANTIATE 114 #endif // LBANN_LAYER_GAUSSIAN_HPP_INCLUDED
gaussian_layer(lbann_comm *comm, const std::vector< int > &dims, TensorDataType mean=El::TypeTraits< TensorDataType >::Zero(), TensorDataType stdev=El::TypeTraits< TensorDataType >::One(), bool training_only=false)
description get_description() const override
Human-readable description.
gaussian_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
Generates nicely formatted description messages.
std::string get_type() const override
Get the layer type's name.
TensorDataType m_stdev
Gaussian distribution standard deviation.
virtual description get_description() const
Human-readable description.
friend class cereal::access
constexpr El::Device Device
void set_output_dims(std::vector< int > dims, size_t output_index=0)
Set output tensor dimensions.
Random tensor with Gaussian/normal distribution.
El::Device get_device_allocation() const override
Get the device allocation for the data tensors. We assume that the decice allocation of the previous ...
TensorDataType m_mean
Gaussian distribution mean.
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
data_layout
Data layout that is optimized for different modes of parallelism.
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
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.
bool m_training_only
Whether to have deterministic output when not training.
int m_expected_num_parent_layers
void serialize(ArchiveT &ar)
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 write_specific_proto(lbann_data::Layer &proto) const final