Skip to content

Commit

Permalink
Made Pylint Happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnstRoell committed Jun 24, 2024
1 parent eee896f commit e899c19
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
27 changes: 14 additions & 13 deletions dect/directions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""
Helper function to generate a structured set of directions in 2 and 3 dimensions.
Helper function to generate a structured set of directions in 2 and 3
dimensions.
"""

import torch
import itertools
import torch


def generate_uniform_directions(num_thetas: int = 64, d: int = 3, device: str = "cpu"):
Expand Down Expand Up @@ -33,9 +34,9 @@ def generate_uniform_2d_directions(num_thetas: int = 64, device: str = "cpu"):
"""
Generate uniformly sampled directions on the unit circle in two dimensions.
Provides a structured set of directions in two dimensions. First the interval
[0,2*pi] is devided into a regular grid and the corresponding angles on the
unit circle calculated.
Provides a structured set of directions in two dimensions. First the
interval [0,2*pi] is devided into a regular grid and the corresponding
angles on the unit circle calculated.
Parameters
----------
Expand All @@ -60,15 +61,15 @@ def generate_multiview_directions(num_thetas: int, bump_steps: int, d: int):
"""
Generates multiple sets of structured directions in n dimensions.
We generate sets of directions by embedding the 2d unit circle in
d dimensions and sample this unit circle in a structured fashion.
This generates d choose 2 structured directions that are organized
in channels, compatible with the ECT calculations.
We generate sets of directions by embedding the 2d unit circle in d
dimensions and sample this unit circle in a structured fashion. This
generates d choose 2 structured directions that are organized in channels,
compatible with the ECT calculations.
After computing the ECT, we obtain an d choose 2 channel image where
each channel consists of a structured ect along a hyperplane.
For the 3-d case we would obtain a 3 channel ect with direction sampled
along the xy, xz and yz planes in three dimensions.
After computing the ECT, we obtain an d choose 2 channel image where each
channel consists of a structured ect along a hyperplane. For the 3-d case we
would obtain a 3 channel ect with direction sampled along the xy, xz and yz
planes in three dimensions.
"""
w = torch.vstack(
[
Expand Down
9 changes: 5 additions & 4 deletions dect/ect.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def compute_ecc(
The shape of the resulting tensor after summation. It has to be of the
shape [num_discretization_steps, batch_size, num_thetas]
scale: torch.FloatTensor
A single number that scales the sigmoid function by multiplying the sigmoid
with the scale. With high (100>) values, the ect will resemble a discrete
ECT and with lower values it will smooth the ECT.
A single number that scales the sigmoid function by multiplying the
sigmoid with the scale. With high (100>) values, the ect will resemble a
discrete ECT and with lower values it will smooth the ECT.
"""
ecc = torch.nn.functional.sigmoid(scale * torch.sub(lin, nh))

Expand Down Expand Up @@ -115,7 +115,8 @@ def compute_ect_edges(data: Batch, v: torch.FloatTensor, lin: torch.FloatTensor)
Parameters
----------
batch : Batch
A batch of data containing the node coordinates, the edges and batch index.
A batch of data containing the node coordinates, the edges and batch
index.
v: torch.FloatTensor
The direction vector that contains the directions.
lin: torch.FloatTensor
Expand Down

0 comments on commit e899c19

Please sign in to comment.