Skip to content

napari_cellseg3d.code_models.models.model_test

Model for testing purposes.

Classes:

Name Description
TestModel

For tests only.

TestModel

Bases: Module

For tests only.

Methods:

Name Description
__init__

Create a TestModel model.

forward

Forward pass of the TestModel model.

Source code in napari_cellseg3d/code_models/models/model_test.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
class TestModel(nn.Module):
    """For tests only."""

    weights_file = "test.pth"
    default_threshold = 0.5

    def __init__(self, **kwargs):
        """Create a TestModel model."""
        super().__init__()
        self.linear = nn.Linear(8, 8)

    def forward(self, x):
        """Forward pass of the TestModel model."""
        return self.linear(torch.tensor(x, requires_grad=True))

__init__

__init__(**kwargs)

Create a TestModel model.

Source code in napari_cellseg3d/code_models/models/model_test.py
13
14
15
16
def __init__(self, **kwargs):
    """Create a TestModel model."""
    super().__init__()
    self.linear = nn.Linear(8, 8)

forward

forward(x)

Forward pass of the TestModel model.

Source code in napari_cellseg3d/code_models/models/model_test.py
18
19
20
def forward(self, x):
    """Forward pass of the TestModel model."""
    return self.linear(torch.tensor(x, requires_grad=True))