convOutputLength: Compute output length in single dimension for convolution...

View source: R/customConvolutionLayers.R

convOutputLengthR Documentation

Compute output length in single dimension for convolution filter

Description

Utility function to calculate the output shape of a convolutional filter along a single dimension. It's based on the python keras utility located here

Usage

convOutputLength(
  inputLength,
  filterSize,
  stride,
  dilation = 1,
  padding = c("same", "valid", "full", "causal")
)

Arguments

inputLength

input size along a single dimension.

filterSize

kernel size along a single dimension.

stride

stride length along a single dimension.

dilation

dilation rate along a single dimension.

padding

type of padding. Can be "same", "valid", "full", or "causal".

Details

https://github.com/keras-team/keras/blob/master/keras/utils/conv_utils.py#L118-L141

but I can't see to locate it's R analog so it's reproduced explicitly in ANTsRNet.

Value

the output size along a single dimension.

Author(s)

Tustison NJ

Examples

library( ANTsRNet )
outputSize <- convOutputLength( 256, filterSize = 3, stride = 2, padding = "same" )
testthat::expect_identical( outputSize, 128 )

ANTsX/ANTsRNet documentation built on Nov. 21, 2024, 4:07 a.m.