fix doc model part 2

This commit is contained in:
giovanni
2025-03-14 16:07:08 +01:00
committed by Nicola Demo
parent 001d1fc9cf
commit f9881a79b5
18 changed files with 887 additions and 851 deletions

View File

@@ -1,5 +1,5 @@
"""
TODO
Module for utility functions for the convolutional layer.
"""
import torch
@@ -7,7 +7,13 @@ import torch
def check_point(x, current_stride, dim):
"""
TODO
Check if the point is in the current stride.
:param torch.Tensor x: The input data.
:param int current_stride: The current stride.
:param int dim: The shape of the filter.
:return: The indeces of the points in the current stride.
:rtype: torch.Tensor
"""
max_stride = current_stride + dim
indeces = torch.logical_and(
@@ -17,13 +23,12 @@ def check_point(x, current_stride, dim):
def map_points_(x, filter_position):
"""Mapping function n dimensional case
"""
The mapping function for n-dimensional case.
:param x: input data of two dimension
:type x: torch.tensor
:param filter_position: position of the filter
:type dim: list[numeric]
:return: data mapped inplace
:param torch.Tensor x: The two-dimensional input data.
:param list[int] filter_position: The position of the filter.
:return: The data mapped in-place.
:rtype: torch.tensor
"""
x.add_(-filter_position)
@@ -32,14 +37,20 @@ def map_points_(x, filter_position):
def optimizing(f):
"""Decorator for calling a function just once
"""
Decorator to call the function only once.
:param f: python function
:type f: function
:type f: Callable
"""
def wrapper(*args, **kwargs):
"""
Wrapper function.
:param args: The arguments of the function.
:param kwargs: The keyword arguments of the function.
"""
if kwargs["type_"] == "forward":
if not wrapper.has_run_inverse:
wrapper.has_run_inverse = True