Class Pad

Inheritance Relationships

Base Type

Class Documentation

class Pad : public mindspore::dataset::TensorTransform

Pad the image according to padding parameters.

Public Functions

explicit Pad(std::vector<int32_t> padding, std::vector<uint8_t> fill_value = {0}, BorderType padding_mode = BorderType::kConstant)

Constructor.

Parameters
  • padding[in] A vector representing the number of pixels to pad the image. If the vector has one value, it pads all sides of the image with that value. If the vector has two values, it pads left and top with the first and right and bottom with the second value. If the vector has four values, it pads left, top, right, and bottom with those values respectively.

  • fill_value[in] A vector representing the pixel intensity of the borders. Only valid if the padding_mode is BorderType.kConstant. If 1 value is provided, it is used for all RGB channels. If 3 values are provided, it is used to fill R, G, B channels respectively.

  • padding_mode[in] The method of padding (default=BorderType.kConstant). Can be any of [BorderType.kConstant, BorderType.kEdge, BorderType.kReflect, BorderType.kSymmetric]

    • BorderType.kConstant, means it fills the border with constant values

    • BorderType.kEdge, means it pads with the last value on the edge

    • BorderType.kReflect, means it reflects the values on the edge omitting the last value of edge

    • BorderType.kSymmetric, means it reflects the values on the edge repeating the last value of edge

~Pad() = default

Destructor.