#include <vector>
#include "layer/layer.h"
#include "tensor/tensor.h"
#include "compute/operation.h"
#include "compute/variable.h"
#include "compute/conv2dforward/conv2dforwardop.h"
Go to the source code of this file.
|
enum | padding_t { SAME,
VALID
} |
|
|
template<typename T > |
Conv2dLayer< T > * | magmadnn::layer::conv2d (op::Operation< T > *input, const std::vector< unsigned int > &filter_shape, int out_channels, const std::vector< unsigned int > &padding, const std::vector< unsigned int > &strides, const std::vector< unsigned int > &dilation_rates, bool use_cross_correlation, bool use_bias, tensor_filler_t< T > filter_initializer, tensor_filler_t< T > bias_initializer) |
|
template<typename T > |
Conv2dLayer< T > * | magmadnn::layer::conv2d (op::Operation< T > *input, const std::vector< unsigned int > &filter_shape, int out_channels, padding_t padding, const std::vector< unsigned int > &strides, const std::vector< unsigned int > &dilation_rates, bool use_cross_correlation, bool use_bias, tensor_filler_t< T > filter_initializer, tensor_filler_t< T > bias_initializer) |
|
- Author
- Daniel Nichols
- Version
- 1.0
- Date
- 2019-07-08
- Copyright
- Copyright (c) 2019
◆ conv2d()
template<typename T >
Conv2dLayer< T > * magmadnn::layer::conv2d |
( |
op::Operation< T > * |
input, |
|
|
const std::vector< unsigned int > & |
filter_shape = {3, 3} , |
|
|
int |
out_channels = 1 , |
|
|
const std::vector< unsigned int > & |
padding = {0, 0} , |
|
|
const std::vector< unsigned int > & |
strides = {1, 1} , |
|
|
const std::vector< unsigned int > & |
dilation_rates = {1, 1} , |
|
|
bool |
use_cross_correlation = true , |
|
|
bool |
use_bias = false , |
|
|
tensor_filler_t< T > |
filter_initializer = {GLOROT,{0.0, 0.2f}} , |
|
|
tensor_filler_t< T > |
bias_initializer = {GLOROT,{0.0, 0.2f}} |
|
) |
| |
Create a Conv2d Layer. Computes the output on the GPU. Uses CuDNN. No host functionality.
- Template Parameters
-
- Parameters
-
input | the input data; must be a 4D tensor in format NCHW (N-batch, C-Channel, H-height, W-Width) |
filter_shape | shape of the convolution kernel. must be a 2 dimensional vector; defaults to {3,3} |
out_channels | number of output filters; defaults to 1 |
padding | the padding size to use. must be a two dimensional vector; defaults to {0,0} |
strides | striding of convolution. must be a two dimensional vector; defaults to {1,1} |
dilation_rates | rate of dilation. must be a two dimensional vector; defaults to {1,1} |
use_cross_correlation | whether to do a cross correlation convolution or standard convolution; defaults to cross correlation |
use_bias | use convolutional bias or not; defaults to false |
filter_initializer | how to initialize the filter tensor; defaults to {GLOROT,{0.0f,0.2f}} |
bias_initializer | how to initialize the bias tensor; defaults to {GLOROT, {0.0f,0.2f}} |
- Returns
- Conv2dLayer<T>* a new layer