Interface SpatialPadding2D<T extends Tensor<T>>

All Superinterfaces:
ITensor, VTensor
All Known Subinterfaces:
ClippedPadding2D<T>, ConstantPadding2D<T>
All Known Implementing Classes:
BaseSpatialPadding2D, ClippedPadding2D_F32, ClippedPadding2D_F64, ConstantPadding2D_F32, ConstantPadding2D_F64, SpatialPadding2D_F32, SpatialPadding2D_F64

public interface SpatialPadding2D<T extends Tensor<T>>
extends VTensor

Interface for all virtual 2D spatial padding implementation. Virtual padding contains a reference to the original input tensor which is going to be padded and on the fly will generate the values for elements which are not explicitly contained in the input tensor. This can reduce memory consumption and is more simplistic to implement for more complex padding methods.

Clipped padding is a special case. In this situation only pixels contained inside the original image should be processed.
  • Method Summary

    Modifier and Type Method Description
    int getClippingOffsetCol​(int paddedCol)
    Returns how far away the column is from the clipping border.
    int getClippingOffsetRow​(int paddedRow)
    Returns how far away the row is from the clipping border.
    int getPaddingCol0()
    Returns the lower-extent padding along the tensor's columns.
    int getPaddingCol1()
    Returns the upper-extent padding along the tensor's columns.
    int getPaddingRow0()
    Returns the lower-extent padding along the tensor's rows.
    int getPaddingRow1()
    Returns the upper-extent padding along the tensor's rows.
    Class<T> getTensorType()
    Returns the type of input tensor it can process
    boolean isClipped()
    Returns true if this is a clipped border or false of it is not.
    void setInput​(T input)
    Spatial tensor that padding is being added around
    int[] shapeGivenInput​(int... inputShape)
    Returns what the tensor's shape will be when given can input tensor with the spcified shape.

    Methods inherited from interface deepboof.ITensor

    createCoor, getDataType, getDimension, getShape, isShape, length
  • Method Details

    • setInput

      void setInput​(T input)
      Spatial tensor that padding is being added around
      Parameters:
      input - The input tensor
    • getClippingOffsetRow

      int getClippingOffsetRow​(int paddedRow)
      Returns how far away the row is from the clipping border. 0 if it is inside the image. Positive is below the lower extent and negative if above upper extent.
      Parameters:
      paddedRow - Row in padded coordinates
      Returns:
      offset
    • getClippingOffsetCol

      int getClippingOffsetCol​(int paddedCol)
      Returns how far away the column is from the clipping border. 0 if it is inside the image. Positive is below the lower extent and negative if above upper extent.
      Parameters:
      paddedCol - Column in padded coordinates
      Returns:
      offset
    • getPaddingRow0

      int getPaddingRow0()
      Returns the lower-extent padding along the tensor's rows.
      Returns:
      padding
    • getPaddingCol0

      int getPaddingCol0()
      Returns the lower-extent padding along the tensor's columns.
      Returns:
      padding
    • getPaddingRow1

      int getPaddingRow1()
      Returns the upper-extent padding along the tensor's rows.
      Returns:
      padding
    • getPaddingCol1

      int getPaddingCol1()
      Returns the upper-extent padding along the tensor's columns.
      Returns:
      padding
    • shapeGivenInput

      int[] shapeGivenInput​(int... inputShape)
      Returns what the tensor's shape will be when given can input tensor with the spcified shape.
      Parameters:
      inputShape - Input spatial tensor. 3-DOF with no mini-batch or 4-DOF with mini-batch
      Returns:
      Tensor's shape
    • isClipped

      boolean isClipped()
      Returns true if this is a clipped border or false of it is not.
      Returns:
      if clipped or not
    • getTensorType

      Class<T> getTensorType()
      Returns the type of input tensor it can process
      Returns:
      Type of tensor