Class SlicePatches

Inheritance Relationships

Base Type

Class Documentation

class SlicePatches : public mindspore::dataset::TensorTransform

说明

Slice the tensor to multiple patches in horizontal and vertical directions.

Public Functions

explicit SlicePatches(int32_t num_height = 1, int32_t num_width = 1, SliceMode slice_mode = SliceMode::kPad, uint8_t fill_value = 0)

Constructor.

Example
/* Define operations */
auto decode_op = vision::Decode();
auto slice_patch_op = vision::SlicePatches(255, 255);

/* dataset is an instance of Dataset object */
dataset = dataset->Map({decode_op, slice_patch_op},  // operations
                       {"image"});                   // input columns

说明

The usage scenerio is suitable to tensor with large height and width. The tensor will keep the same if set both num_height and num_width to 1. And the number of output tensors is equal to num_height*num_width.

参数
  • num_height[in] The number of patches in vertical direction (default=1).

  • num_width[in] The number of patches in horizontal direction (default=1).

  • slice_mode[in] An enum for the mode of slice (default=SliceMode::kPad).

  • fill_value[in] A value representing the pixel to fill the padding area in right and bottom border if slice_mode is kPad. Then padded tensor could be just sliced to multiple patches (default=0).

~SlicePatches() = default

Destructor.