public class Convolution1DUtils extends Object
Modifier and Type | Method and Description |
---|---|
static int |
effectiveKernelSize(int kernel,
int dilation) |
static int |
getOutputSize(INDArray inputData,
int kernel,
int strides,
int padding,
ConvolutionMode convolutionMode) |
static int |
getOutputSize(INDArray inputData,
int kernel,
int strides,
int padding,
ConvolutionMode convolutionMode,
int dilation)
Get the output size (height) for the given input data and CNN1D configuration
|
static long |
getOutputSize(long inH,
int kernel,
int strides,
int padding,
ConvolutionMode convolutionMode,
int dilation)
Get the output size (height) for the given input data and CNN1D configuration
|
static RNNFormat |
getRnnFormatFromLayer(Layer layer)
Get the
RNNFormat for the given layer. |
static int |
getSameModeBottomRightPadding(int outSize,
int inSize,
int kernel,
int strides,
int dilation) |
static int |
getSameModeTopLeftPadding(int outSize,
int inSize,
int kernel,
int strides,
int dilation)
Get top padding for same mode only.
|
static boolean |
hasRnnDataFormat(Layer layer)
Returns true if the given layer has an
RNNFormat . |
static INDArray |
reshapeWeightArrayOrGradientForFormat(INDArray w,
RNNFormat rnnFormat)
Reshapes the given weight
array or weight gradient
to work with the specified
RNNFormat |
static void |
validateCnn1DKernelStridePadding(int kernel,
int stride,
int padding)
Perform validation on the CNN layer kernel/stride/padding.
|
static void |
validateConvolutionModePadding(ConvolutionMode mode,
int padding)
Check that the convolution mode is consistent with the padding specification
|
static void |
validateShapes(INDArray inputData,
int eKernel,
int strides,
int padding,
ConvolutionMode convolutionMode,
int dilation,
int inShape,
boolean atrous) |
public static int getOutputSize(INDArray inputData, int kernel, int strides, int padding, ConvolutionMode convolutionMode)
public static boolean hasRnnDataFormat(Layer layer)
RNNFormat
.
This is true for:
Convolution1DLayer
,
Subsampling1DLayer
SimpleRnn
LSTM
EmbeddingSequenceLayer
layer
- the layer to testpublic static RNNFormat getRnnFormatFromLayer(Layer layer)
RNNFormat
for the given layer.
Throws an IllegalArgumentException
if a layer doesn't have an rnn formatlayer
- the layer to get the format forpublic static INDArray reshapeWeightArrayOrGradientForFormat(INDArray w, RNNFormat rnnFormat)
RNNFormat
w
- the weight array or gradientrnnFormat
- the RNNFormat
to usepublic static long getOutputSize(long inH, int kernel, int strides, int padding, ConvolutionMode convolutionMode, int dilation)
inH
- Input size (height, or channels).kernel
- Kernel sizestrides
- Stridepadding
- PaddingconvolutionMode
- Convolution mode (Same, Strict, Truncate)dilation
- Kernel dilationpublic static int getOutputSize(INDArray inputData, int kernel, int strides, int padding, ConvolutionMode convolutionMode, int dilation)
inputData
- Input datakernel
- Kernel sizestrides
- Stridepadding
- PaddingconvolutionMode
- Convolution mode (Same, Strict, Truncate)dilation
- Kernel dilationpublic static void validateShapes(INDArray inputData, int eKernel, int strides, int padding, ConvolutionMode convolutionMode, int dilation, int inShape, boolean atrous)
public static int effectiveKernelSize(int kernel, int dilation)
public static void validateConvolutionModePadding(ConvolutionMode mode, int padding)
public static int getSameModeTopLeftPadding(int outSize, int inSize, int kernel, int strides, int dilation)
outSize
- Output size (length 2 array, height dimension first)inSize
- Input size (length 2 array, height dimension first)kernel
- Kernel size (length 2 array, height dimension first)strides
- Strides (length 2 array, height dimension first)dilation
- Dilation (length 2 array, height dimension first)public static int getSameModeBottomRightPadding(int outSize, int inSize, int kernel, int strides, int dilation)
public static void validateCnn1DKernelStridePadding(int kernel, int stride, int padding)
kernel
- Kernel size to checkstride
- Stride to checkpadding
- Padding to checkCopyright © 2021. All rights reserved.