Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

update docs for rad2deg and deg2rad

edgarriba645fe0820b08
diff --git a/docs/source/_static/css/pytorch_theme.css b/docs/source/_static/css/pytorch_theme.css
index 55ae8e2d7..c49d94d16 100644
--- a/docs/source/_static/css/pytorch_theme.css
+++ b/docs/source/_static/css/pytorch_theme.css
@@ -29,7 +29,7 @@ h1, h2, .rst-content .toctree-wrapper p.caption, h3, h4, h5, h6, legend, p.capti
/* Fixes for mobile */
.wy-nav-top {
background-color: #fff;
- /background-image: url('../img/arraiy-logo-text-black-large-final.svg');
+ background-image: url('../img/arraiy-logo-text-black-large-final.svg');
background-repeat: no-repeat;
background-position: center;
padding: 0;
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 93958aa8c..5dfbf79f7 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -109,9 +109,6 @@ html_context = {
],
}
-add_module_names = False
-
-
# -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder.
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 1cbe802dd..d6c07f907 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -14,18 +14,20 @@ Version v0.1.0 focuses on Image and tensor warping functions such as:
* Homography
* Depth
+
.. automodule:: torchgeometry
+
Pinhole
--------
-.. autofunction:: inverse
.. autofunction:: inverse_pose
.. autofunction:: pinhole_matrix
.. autofunction:: inv_pinhole_matrix
.. autofunction:: scale_pinhole
.. autofunction:: homography_i_H_ref
+
Conversions
-----------
@@ -34,13 +36,21 @@ Conversions
.. autofunction:: convert_points_from_homogeneous
.. autofunction:: convert_points_to_homogeneous
.. autofunction:: transform_points
+.. autofunction:: angle_axis_to_rotation_matrix
+.. autofunction:: rotation_matrix_to_angle_axis
+.. autofunction:: rotation_matrix_to_quaternion
+.. autofunction:: quaternion_to_angle_axis
+.. autofunction:: rtvec_to_pose
+
Utilities
---------
+.. autofunction:: inverse
.. autofunction:: tensor_to_image
.. autofunction:: image_to_tensor
+
Containers
----------
diff --git a/torchgeometry/functional.py b/torchgeometry/functional.py
index c04359830..efdb6c05e 100644
--- a/torchgeometry/functional.py
+++ b/torchgeometry/functional.py
@@ -24,36 +24,44 @@ __all__ = [
pi = torch.Tensor([3.141592653589793])
-def rad2deg(x):
+def rad2deg(tensor):
"""Converts angles from radians to degrees.
Args:
- x (Tensor): tensor of unspecified size.
+ tensor (Tensor): Tensor to be converted of unspecified shape.
Returns:
- Tensor: tensor with same size as input.
+ Tensor: Converted tensor with same shape as input.
+
+ Example:
+ >>> input = tgm.pi * torch.rand(1, 3, 3)
+ >>> output = tgm.rad2deg(input)
"""
- if not torch.is_tensor(x):
+ if not torch.is_tensor(tensor):
raise TypeError("Input type is not a torch.Tensor. Got {}"
- .format(type(x)))
+ .format(type(tensor)))
- return 180. * x / pi.to(x.device).type(x.dtype)
+ return 180. * tensor / pi.to(tensor.device).type(tensor.dtype)
-def deg2rad(x):
+def deg2rad(tensor):
"""Converts angles from degrees to radians.
Args:
- x (Tensor): tensor of unspecified size.
+ tensor (Tensor): Tensor to be converted of unspecified shape.
Returns:
- Tensor: tensor with same size as input.
+ Tensor: Converted tensor with same shape as input.
+
+ Example:
+ >>> input = 360. * torch.rand(1, 3, 3)
+ >>> output = tgm.deg2rad(input)
"""
- if not torch.is_tensor(x):
+ if not torch.is_tensor(tensor):
raise TypeError("Input type is not a torch.Tensor. Got {}"
- .format(type(x)))
+ .format(type(tensor)))
- return x * pi.to(x.device).type(x.dtype) / 180.
+ return tensor * pi.to(tensor.device).type(tensor.dtype) / 180.
def convert_points_from_homogeneous(points, eps=1e-6):