deepsphere.layers package

Submodules

deepsphere.layers.chebyshev module

Chebyshev convolution layer. For the moment taking as-is from Michaël Defferrard’s implementation. For v0.15 we will rewrite parts of this layer.

class deepsphere.layers.chebyshev.ChebConv(in_channels, out_channels, kernel_size=1, bias=True, conv=<function cheb_conv>)[source]

Bases: torch.nn.modules.module.Module

Graph convolutional layer.

forward(laplacian, inputs)[source]

Forward graph convolution.

Parameters:
  • laplacian (torch.sparse.Tensor) – The laplacian corresponding to the current sampling of the sphere.
  • inputs (torch.Tensor) – The current input data being forwarded.
Returns:

The convoluted inputs.

Return type:

torch.Tensor

kaiming_initialization()[source]

Initialize weights and bias.

class deepsphere.layers.chebyshev.SphericalChebConv(in_channels, out_channels, lap, kernel_size=3)[source]

Bases: torch.nn.modules.module.Module

Building Block with a Chebyshev Convolution.

forward(x)[source]

Forward pass.

Parameters:x (torch.tensor) – input [batch x vertices x channels/features]
Returns:output [batch x vertices x channels/features]
Return type:torch.tensor
state_dict(*args, **kwargs)[source]

! WARNING !

This function overrides the state dict in order to be able to save the model. This can be removed as soon as saving sparse matrices has been added to Pytorch.

deepsphere.layers.chebyshev.cheb_conv(laplacian, inputs, weight)[source]

Chebyshev convolution.

Parameters:
  • laplacian (torch.sparse.Tensor) – The laplacian corresponding to the current sampling of the sphere.
  • inputs (torch.Tensor) – The current input data being forwarded.
  • weight (torch.Tensor) – The weights of the current layer.
Returns:

Inputs after applying Chebyshev convolution.

Return type:

torch.Tensor

Module contents