Skip to content

Commit

Permalink
docs: improve cross-referencing for literals
Browse files Browse the repository at this point in the history
  • Loading branch information
adosar committed Jan 25, 2025
1 parent 6d72472 commit f940127
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/aidsorb/_torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_activation(config=None):
Parameters
----------
config : dict, default=None
Dictionary for configuring activation function. If ``None``, the
Dictionary for configuring activation function. If :obj:`None`, the
:class:`~torch.nn.modules.activation.ReLU` activation is used.
* ``'name'`` activation's class name :class:`str`
Expand Down Expand Up @@ -109,7 +109,7 @@ def get_optimizers(params, config_optim=None, config_lrs=None):
params : iterable
Iterable containing the parameters to be optimized.
config_optim : dict, default=None
Dictionary for configuring optimizer. If ``None``, the
Dictionary for configuring optimizer. If :obj:`None`, the
:class:`~torch.optim.Adam` optimizer with default hyperparameters is
used.
Expand Down
26 changes: 14 additions & 12 deletions src/aidsorb/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def prepare_data(source: str, split_ratio: Sequence = None, seed: int = 1):
Absolute or relative path to the directory holding the point clouds.
split_ratio : sequence, default=None
Absolute sizes or fractions of splits of the form ``(train, val,
test)``. If ``None``, it is set to ``(0.8, 0.1, 0.1)``.
test)``. If :obj:`None`, it is set to ``(0.8, 0.1, 0.1)``.
seed : int, default=1
Controls randomness of the ``rng`` used for splitting.
Expand Down Expand Up @@ -128,6 +128,16 @@ def pad_pcds(pcds, channels_first, mode='upsample', return_mask=False):
Each point cloud must have shape ``(N_i, C)``.
.. rubric:: Shapes
* ``batch`` tensor of shape ``(B, T, C)`` if ``channels_first=False``,
else ``(B, C, T)``.
* ``mask`` boolean tensor of shape ``(B, T)`` where :obj:`True` indicates
padding.
``B`` is the batch size and ``T`` is the size of the largest point
cloud in the sequence.
Parameters
----------
pcds : sequence of tensors
Expand All @@ -140,14 +150,6 @@ def pad_pcds(pcds, channels_first, mode='upsample', return_mask=False):
tensor or tuple of length 2
``batch`` if ``return_mask=False``, else ``(batch, mask)``.
* ``batch`` tensor of shape ``(B, T, C)`` if ``channels_first=False``,
else ``(B, C, T)``.
* ``mask`` boolean tensor of shape ``(B, T)`` where ``True`` indicates
padding.
``B`` is the batch size and ``T`` is the size of the largest point
cloud in the sequence.
See Also
--------
:func:`~.upsample_pcd` : For a description of ``'upsample'`` mode.
Expand Down Expand Up @@ -246,15 +248,15 @@ class Collator:
Each sample is a tuple of ``(pcd, label)``.
* ``pcd`` tensor of shape ``(N_i, C)``.
* ``label`` tensor of shape ``(n_outputs,)``, ``()`` or ``None``.
* ``label`` tensor of shape ``(n_outputs,)``, ``()`` or :obj:`None`.
* Output: tuple of length 2
If ``return_mask=False``, then output is ``(x, y)``, else ``((x, mask), y)``.
* ``x`` tensor of shape ``(B, C, T)`` if ``channels_first=True``, else ``(B, T, C)``.
* ``y`` tensor of shape ``(B, n_outputs)``, ``(B,)`` or ``None``.
* ``mask`` boolean tensor of shape ``(B, T)`` where ``True`` indicates padding.
* ``y`` tensor of shape ``(B, n_outputs)``, ``(B,)`` or :obj:`None`.
* ``mask`` boolean tensor of shape ``(B, T)`` where :obj:`True` indicates padding.
``B`` is the batch size and ``T`` is the size of the largest point cloud in the
sequence.
Expand Down
2 changes: 1 addition & 1 deletion src/aidsorb/datamodules.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class PCDDataModule(L.LightningDataModule):
Column names of the ``.csv`` file containing the properties to be
predicted.
train_size : int, optional
Number of training samples. If ``None``, all training samples are used.
Number of training samples. If :obj:`None`, all training samples are used.
train_transform_x : callable, optional
Transformation to apply to point cloud during training.
eval_transform_x : callable, optional
Expand Down
2 changes: 1 addition & 1 deletion src/aidsorb/litmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class PCDLit(L.LightningModule):
metric : :class:`~torchmetrics.MetricCollection`
Metric(s) to be logged and optionally monitored.
config_optimizer : dict, default=None
Dictionary for configuring optimizer. If ``None``, the
Dictionary for configuring optimizer. If :obj:`None`, the
:class:`~torch.optim.Adam` optimizer with default hyperparameters is
used.
Expand Down
10 changes: 5 additions & 5 deletions src/aidsorb/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def conv1d_block(in_channels, out_channels, config_activation=None, **kwargs):
Parameters
----------
in_channels : int or None
If ``None``, the ``conv_layer`` is lazy initialized.
If :obj:`None`, the ``conv_layer`` is lazy initialized.
out_channels : int
config_activation : dict, default=None
Dictionary for configuring activation function. If ``None``, the
Dictionary for configuring activation function. If :obj:`None`, the
:class:`~torch.nn.modules.activation.ReLU` activation is used.
* ``'name'`` activation's class name :class:`str`
Expand Down Expand Up @@ -119,10 +119,10 @@ def dense_block(in_features, out_features, config_activation=None, **kwargs):
Parameters
----------
in_features : int or None
If ``None``, the ``linear_layer`` is lazy initialized.
If :obj:`None`, the ``linear_layer`` is lazy initialized.
out_features : int
config_activation : dict, default=None
Dictionary for configuring activation function. If ``None``, the
Dictionary for configuring activation function. If :obj:`None`, the
:class:`~torch.nn.modules.activation.ReLU` activation is used.
* ``'name'`` activation's class name :class:`str`
Expand Down Expand Up @@ -258,7 +258,7 @@ class PointNetBackbone(nn.Module):
Parameters
----------
local_feats : bool, default=False
If ``True``, the returned features are a concatenation of local features
If :obj:`True`, the returned features are a concatenation of local features
and global features. Otherwise, the global features are returned.
n_global_feats : int, default=1024
Number of global features.
Expand Down
5 changes: 3 additions & 2 deletions src/aidsorb/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def draw_pcd(
* The size of each point is determined by its atomic number ``pcd[i, 3]``.
* The color of each point is determined by ``feature_to_color``. If ``None``,
* The color of each point is determined by ``feature_to_color``. If :obj:`None`,
the atomic number of each point determines the color. Otherwise, ``pcd[i,
feature_to_color[0]]`` value determines the color.
Expand Down Expand Up @@ -168,7 +168,8 @@ def draw_pcd_from_file(filename: str, render: bool = True, **kwargs):
Returns
-------
render : :class:`~plotly.graph_objects.Figure` if ``render=False``, else ``None``.
:class:`~plotly.graph_objects.Figure` or :obj:`None`
:class:`~plotly.graph_objects.Figure` if ``render=False``, else :obj:`None`.
"""
if filename.endswith('.npy'):
pcd = np.load(filename)
Expand Down

0 comments on commit f940127

Please sign in to comment.