Class SlicePatches
Defined in File vision.h
Inheritance Relationships
Base Type
public mindspore::dataset::TensorTransform
(Class TensorTransform)
Class Documentation
-
class SlicePatches : public mindspore::dataset::TensorTransform
Note
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.
Note
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.
- Parameters
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).
样例/* 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
-
~SlicePatches() = default
Destructor.
-
explicit SlicePatches(int32_t num_height = 1, int32_t num_width = 1, SliceMode slice_mode = SliceMode::kPad, uint8_t fill_value = 0)