RandomVerticalFlipOp class
Randomly flips a tensor top-to-bottom with configurable probability.
Useful for data augmentation in tasks where vertical orientation is not semantically important (e.g., satellite imagery, medical imaging).
Supports 3D [C, H, W] and 4D [N, C, H, W] tensor formats.
Equivalent to PyTorch's torchvision.transforms.RandomVerticalFlip(p)
or TensorFlow's tf.image.random_flip_up_down().
Complexity
Let N = batch, C = channels, H = height, W = width.
- Time: O(N × C × H × W) when flip occurs, O(1) when skipped (returns clone).
- Space: O(N × C × H × W) for output buffer.
- Inheritance
-
- Object
- TransformOp
- RandomVerticalFlipOp
- Mixed-in types
Constructors
- RandomVerticalFlipOp({double probability = 0.5, int? seed})
- Creates a random vertical flip operation.
Properties
- capabilities → OperationCapabilities
-
The capabilities of this operation.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The human-readable name of this operation.
no setteroverride
- probability → double
-
Probability of flipping the tensor. Must be in
0.0, 1.0.final - requiresContiguous → bool
-
Whether this operation requires contiguous input.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seed → int?
-
Optional random seed for reproducibility.
final
Methods
-
apply(
TensorBuffer input) → TensorBuffer -
Applies this transform to
inputand returns the result.override -
call(
TensorBuffer input) → TensorBuffer -
Alias for apply.
inherited
-
cloneForModification(
TensorBuffer input) → TensorBuffer -
Creates an output buffer from input, ensuring contiguity with single copy.
inherited
-
computeOutputShape(
List< int> inputShape) → List<int> -
Computes the output shape for a given
inputShape.override -
ensureContiguous(
TensorBuffer input) → TensorBuffer -
Returns a contiguous version of
inputif needed.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited