Browse Source

docs(mge): warp_perspective, gather & scatter

GitOrigin-RevId: f2436e8501
release-1.1
Megvii Engine Team 4 years ago
parent
commit
e64760fe2b
2 changed files with 6 additions and 0 deletions
  1. +4
    -0
      imperative/python/megengine/functional/nn.py
  2. +2
    -0
      imperative/python/megengine/functional/tensor.py

+ 4
- 0
imperative/python/megengine/functional/nn.py View File

@@ -884,6 +884,10 @@ def warp_perspective(
:param interp_mode: interpolation methods. Default: "LINEAR" :param interp_mode: interpolation methods. Default: "LINEAR"
:return: output tensor. :return: output tensor.


Note:

The transformation matrix is the inverse of that used by `cv2.warpPerspective`.

Examples: Examples:


.. testcode:: .. testcode::


+ 2
- 0
imperative/python/megengine/functional/tensor.py View File

@@ -391,6 +391,7 @@ def _get_idx(index, axis):




def gather(inp: Tensor, axis: int, index: Tensor) -> Tensor: def gather(inp: Tensor, axis: int, index: Tensor) -> Tensor:
# TODO: rewrite doc
r"""Gathers data from input tensor on axis using index. r"""Gathers data from input tensor on axis using index.


For a 3-D tensor, the output is specified by:: For a 3-D tensor, the output is specified by::
@@ -462,6 +463,7 @@ def gather(inp: Tensor, axis: int, index: Tensor) -> Tensor:




def scatter(inp: Tensor, axis: int, index: Tensor, source: Tensor) -> Tensor: def scatter(inp: Tensor, axis: int, index: Tensor, source: Tensor) -> Tensor:
# TODO: rewrite doc
r"""Writes all values from the tensor source into input tensor r"""Writes all values from the tensor source into input tensor
at the indices specified in the index tensor. at the indices specified in the index tensor.




Loading…
Cancel
Save