@@ -644,9 +644,7 @@ class affine(Operation):
644
644
the coordinates ``x’`` and ``y’`` with the following equation, and then computing the
645
645
value at the coordinate ``(x’,y’)`` in the input image using either bilinear or
646
646
nearest neighbor interpolation. If the ``(x’, y’)`` point falls outside the input
647
- image, then padding information is used to compute the value.
648
-
649
- ::
647
+ image, then padding information is used to compute the value::
650
648
651
649
x’ = a0 * x + a1 * y + a2
652
650
y’ = b0 * x + b1 * y + b2
@@ -655,45 +653,41 @@ class affine(Operation):
655
653
Parameters
656
654
----------
657
655
x: tensor<[B, C, H1, W1], T>
658
- * Must be rank ``4``.
656
+ * Must be rank ``4``.
659
657
transform_matrix: tensor<[D, 6], T>
660
- * Must be rank ``2``.
661
- * ``D`` can be either ``B`` or 1.
662
- * If ``D == B``, there is a separate transform matrix for each batch.
663
- * If ``D == 1``, the same matrix is used for all input batches.
664
- * For each batch: ``[a0, a1, a2, b0, b1, b2]``.
658
+ * Must be rank ``2``.
659
+ * ``D`` can be either ``B`` or 1.
660
+ * If ``D == B``, there is a separate transform matrix for each batch.
661
+ * If ``D == 1``, the same matrix is used for all input batches.
662
+ * For each batch: ``[a0, a1, a2, b0, b1, b2]``.
665
663
output_height: const<i32>
666
- * Target output height
664
+ * Target output height
667
665
output_width: const<i32>
668
- * Target output width
666
+ * Target output width
669
667
sampling_mode: const<str>
670
- * Allowed values: ``"bilinear"``
668
+ * Allowed values: ``"bilinear"``
671
669
padding_mode: const<str>
672
- * Allowed values: ``"constant"``.
673
- * Note that the following example is 1D case for brevity.
674
- The op supports only 2D image input.
675
- * If ``padding_mode == "constant"``:
676
- * The input image is assumed to be padded with the padding_value.
677
- * For example, ``|1, 2, 3| -> |0, 0, 0, 1, 2, 3, 0, 0, 0|``.
670
+ * Allowed values: ``"constant"``.
671
+ * Note that the following example is 1D case for brevity. The op supports only 2D image input.
672
+ * If ``padding_mode == "constant"``:
673
+ * The input image is assumed to be padded with the padding_value.
674
+ * For example, ``|1, 2, 3| -> |0, 0, 0, 1, 2, 3, 0, 0, 0|``.
678
675
padding_value: const<T>
679
- * Currently non-zero values are not supported.
680
- * To be used only when ``padding_mode == "constant"``, ignored in other cases.
676
+ * Currently non-zero values are not supported.
677
+ * To be used only when ``padding_mode == "constant"``, ignored in other cases.
681
678
coordinates_mode: const<str>
682
- * Allowed values: ``"normalized_minus_one_to_one"``
683
- * If ``coordinates_mode == "normalized_minus_one_to_one"``, in-image values are ``[-1, 1]``.
684
- * For example, if ``coordinates_mode == "normalized_minus_one_to_one"``,
685
- the in range values are ``[-1, 1]``. That is:
686
- * ``(-1, -1)``, i.e. ``(w=-1, h=-1)``, corresponds to the top-left pixel.
687
- * ``(1, -1)``, i.e. ``(w=1, h=-1)``, corresponds to the top-right pixel.
688
- * ``(-1, 1)``, i.e. ``(w=-1, h=1)``, corresponds to the bottom-left pixel.
689
- * ``(1, 1)``, i.e. ``(w=1, h=1)``, corresponds to the bottom-right pixel.
679
+ * Allowed values: ``"normalized_minus_one_to_one"``.
680
+ * If ``coordinates_mode == "normalized_minus_one_to_one"``, in-image values are ``[-1, 1]``.
681
+ * For example, if ``coordinates_mode == "normalized_minus_one_to_one"``, the in-range values are ``[-1, 1]``. That is:
682
+ * ``(-1, -1)``, i.e. ``(w=-1, h=-1)``, corresponds to the top-left pixel.
683
+ * ``(1, -1)``, i.e. ``(w=1, h=-1)``, corresponds to the top-right pixel.
684
+ * ``(-1, 1)``, i.e. ``(w=-1, h=1)``, corresponds to the bottom-left pixel.
685
+ * ``(1, 1)``, i.e. ``(w=1, h=1)``, corresponds to the bottom-right pixel.
690
686
align_corners: const<bool>
691
- * Currently ``align_corners=False`` is not supported.
692
- * To be used only when ``coordinates_mode != unnormalized``, ignored otherwise.
693
- * if ``align_corners == True``, the extrema coordinates correspond
694
- to the center of the first and last corner pixels.
695
- * if ``align_corners == False``, the extrema coordinates correspond
696
- to the edge of the first and last corner pixels.
687
+ * Currently ``align_corners=False`` is not supported.
688
+ * To be used only when ``coordinates_mode != unnormalized``, ignored otherwise.
689
+ * If ``align_corners == True``, the extrema coordinates correspond to the center of the first and last corner pixels.
690
+ * If ``align_corners == False``, the extrema coordinates correspond to the edge of the first and last corner pixels.
697
691
698
692
Returns
699
693
-------
@@ -799,20 +793,20 @@ class resample(Operation):
799
793
* Note that the following example is 1D case for brevity.
800
794
The op supports only 2D image input.
801
795
* If ``padding_mode == "constant"``:
802
- * The input image is assumed to be padded with the ``padding_value``.
803
- * For example: ``|1, 2, 3| -> |0, 0, 0, 1, 2, 3, 0, 0, 0|``
796
+ * The input image is assumed to be padded with the ``padding_value``.
797
+ * For example: ``|1, 2, 3| -> |0, 0, 0, 1, 2, 3, 0, 0, 0|``
804
798
* if ``padding_mode == "border"``:
805
- * The input image is assumed to be padded with the values replicated
806
- from the values at the edge. This is also referred to as the
807
- "clamped" or "replication" mode, since the padded values are
808
- clamped to the border values.
809
- * For example: ``|1, 2, 3| -> |1, 1, 1, 1, 2, 3, 3, 3, 3|``
799
+ * The input image is assumed to be padded with the values replicated
800
+ from the values at the edge. This is also referred to as the
801
+ "clamped" or "replication" mode, since the padded values are
802
+ clamped to the border values.
803
+ * For example: ``|1, 2, 3| -> |1, 1, 1, 1, 2, 3, 3, 3, 3|``
810
804
* If ``padding_mode == "reflection"``:
811
- * The border values are reflected, *not* including the values at the edge/border.
812
- * For example: ``|1, 2, 3| -> |2, 3, 2, 1, 2, 3, 2, 1, 2|``
805
+ * The border values are reflected, *not* including the values at the edge/border.
806
+ * For example: ``|1, 2, 3| -> |2, 3, 2, 1, 2, 3, 2, 1, 2|``
813
807
* If ``padding_mode == "symmetric"``:
814
- * Values are reflected, including the border/edge values.
815
- * For example: ``|1, 2, 3| -> |3, 2, 1 , 1, 2, 3, 3, 2, 1|``
808
+ * Values are reflected, including the border/edge values.
809
+ * For example: ``|1, 2, 3| -> |3, 2, 1 , 1, 2, 3, 3, 2, 1|``
816
810
padding_value: const<T>
817
811
* To be used only when ``padding_mode == "constant"``, ignored in other cases.
818
812
coordinates_mode: const<str>
@@ -825,17 +819,14 @@ class resample(Operation):
825
819
the in-image values are ``[-1, 1]``.
826
820
* If ``coordinates_mode == "normalized_zero_to_one"``,
827
821
in-image values are ``[0, 1]``.
828
- * For example, if ``coordinates_mode == "normalized_minus_one_to_one"``,
829
- the in range values are [-1, 1]. That is:
830
- * ``(-1, -1)``, i.e. ``(w=-1, h=-1)``, corresponds to the top-left pixel.
831
- * ``(1, -1)``, i.e. ``(w=1, h=-1)``, corresponds to the top-right pixel.
832
- * ``(-1, 1)``, i.e. ``(w=-1, h=1)``, corresponds to the bottom-left pixel.
833
- * ``(1, 1)``, i.e. ``(w=1, h=1)``, corresponds to the bottom-right pixel.
822
+ * For example, if ``coordinates_mode == "normalized_minus_one_to_one"``, the in range values are [-1, 1]. That is:
823
+ * ``(-1, -1)``, i.e. ``(w=-1, h=-1)``, corresponds to the top-left pixel.
824
+ * ``(1, -1)``, i.e. ``(w=1, h=-1)``, corresponds to the top-right pixel.
825
+ * ``(-1, 1)``, i.e. ``(w=-1, h=1)``, corresponds to the bottom-left pixel.
826
+ * ``(1, 1)``, i.e. ``(w=1, h=1)``, corresponds to the bottom-right pixel.
834
827
align_corners: const<bool>
835
- * If ``align_corners == True``, the extrema coordinates correspond
836
- to the center of the first and last corner pixels.
837
- * If ``align_corners == False``, the extrema coordinates correspond
838
- to the edge of the first and last corner pixels.
828
+ * If ``align_corners == True``, the extrema coordinates correspond to the center of the first and last corner pixels.
829
+ * If ``align_corners == False``, the extrema coordinates correspond to the edge of the first and last corner pixels.
839
830
840
831
Returns
841
832
-------
0 commit comments