27 #ifndef LBANN_LAYERS_LEARNING_CONVOLUTION_HPP_INCLUDED 28 #define LBANN_LAYERS_LEARNING_CONVOLUTION_HPP_INCLUDED 36 #ifdef LBANN_HAS_DISTCONV 37 template <
typename TensorDataType, data_layout Layout, El::Device Device>
38 class convolution_distconv_adapter
39 :
public base_convolution_adapter<TensorDataType, Device>
43 typename base_convolution_adapter<TensorDataType, Device>::TensorDevType;
45 convolution_distconv_adapter(Layer& layer)
46 : base_convolution_adapter<TensorDataType,
Device>(layer)
48 virtual ~convolution_distconv_adapter() =
default;
50 void setup_distributions(tensor_overlap_constraints& constraints)
override;
51 void setup_layer(
size_t workspace_capacity)
override;
52 dc::Shape get_activations_local_shape(
int index = 0)
const override;
54 #endif // LBANN_HAS_DISTCONV 67 template <
typename TensorDataType,
74 "convolution layer only supports DATA_PARALLEL");
78 int num_output_channels,
84 bool has_bias =
true);
87 int num_output_channels,
88 std::vector<int> conv_dims,
89 std::vector<int> pads,
90 std::vector<int> strides,
91 std::vector<int> dilations,
93 bool has_bias =
true);
100 std::string
get_type()
const override {
return "convolution"; }
113 #ifdef LBANN_HAS_ONNX 114 std::string get_onnx_op_type()
const override {
return "Conv"; }
115 void fill_onnx_node(onnx::GraphProto& graph)
const override;
116 #endif // LBANN_HAS_ONNX 121 template <
typename ArchiveT>
128 void write_specific_proto(lbann_data::Layer& proto)
const final;
130 friend class cereal::access;
133 void setup_dims()
override;
134 std::vector<int> get_kernel_dims()
const override;
135 void fp_compute()
override;
136 void bp_compute()
override;
138 #ifdef LBANN_HAS_DISTCONV 139 friend class convolution_distconv_adapter<TensorDataType, Layout, Device>;
142 void setup_distconv_adapter()
override;
143 bool is_distconv_supported()
const override;
144 #endif // LBANN_HAS_DISTCONV 150 #ifndef LBANN_CONVOLUTION_LAYER_INSTANTIATE 152 #define PROTO_DEVICE(T, Device) \ 153 extern template class convolution_layer<T, \ 154 data_layout::DATA_PARALLEL, \ 160 #endif // LBANN_CONVOLUTION_LAYER_INSTANTIATE 164 #endif // LBANN_LAYERS_LEARNING_CONVOLUTION_HPP_INCLUDED
std::basic_string< T > pad(const std::basic_string< T > &s, typename std::basic_string< T >::size_type n, T c)
bool can_run_inplace() const override
If True, the computation can run in-place (feeding each input activations tensor as the corresponding...
convolution_layer * copy() const override
Copy function. This function dynamically allocates memory for a layer instance and instantiates a cop...
void serialize(std::ostream &os, google::protobuf::Message const &msg)
Serialize the protobuf message to a stream.
int get_backprop_requirements() const override
Returns the necessary tensors for computing backpropagation.
constexpr El::Device Device
::distconv::tensor::Shape Shape
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.
std::string get_type() const override
Get the layer type's name.
LBANN_DEFINE_LAYER_BUILDER(elu)
data_layout get_data_layout() const override
Get data layout of the data tensors. We assume that the data layouts of the previous activations...
Computation kernels for convolution and deconvolution layers.