Abstract base class for all PyTorch neural network models in the package.
Architecture & Forward Pass Execution Flowchart:
graph TD
A["Input Data Batch (Images / Tokens / Embeddings)"] --> B["BaseModel.forward(inputs)"]
B --> C["Feature Extractor / Backbone"]
C --> D["Neural Layer Blocks (Conv / Attention / Residual)"]
D --> E["Task Prediction Head (Logits)"]
E --> F["Loss Function (Focal / Dice / CrossEntropy)"]
F --> G["Backward Pass & Gradient Calculation"]
G --> H["Optimizer Step (AdamW / SGD)"]
H --> I["Metric Logging & Model Checkpoint"]
Source code in src/tensoris/models/model.py
| class BaseModel:
"""Abstract base class for all PyTorch neural network models in the package.
Architecture & Forward Pass Execution Flowchart:
```mermaid
graph TD
A["Input Data Batch (Images / Tokens / Embeddings)"] --> B["BaseModel.forward(inputs)"]
B --> C["Feature Extractor / Backbone"]
C --> D["Neural Layer Blocks (Conv / Attention / Residual)"]
D --> E["Task Prediction Head (Logits)"]
E --> F["Loss Function (Focal / Dice / CrossEntropy)"]
F --> G["Backward Pass & Gradient Calculation"]
G --> H["Optimizer Step (AdamW / SGD)"]
H --> I["Metric Logging & Model Checkpoint"]
```
"""
def __init__(self) -> None:
"""Initialize base model hyperparameters."""
pass
def forward(self, inputs: list[float]) -> list[float]:
"""Execute a forward pass computation.
Args:
inputs: Input tensor data sample.
Returns:
Output forward prediction tensor.
"""
return inputs
|
Methods:
__init__
Initialize base model hyperparameters.
Source code in src/tensoris/models/model.py
| def __init__(self) -> None:
"""Initialize base model hyperparameters."""
pass
|
forward
Execute a forward pass computation.
Parameters:
| Name |
Type |
Description |
Default |
inputs
|
list[float]
|
Input tensor data sample.
|
required
|
Returns:
| Type |
Description |
list[float]
|
Output forward prediction tensor.
|
Source code in src/tensoris/models/model.py
| def forward(self, inputs: list[float]) -> list[float]:
"""Execute a forward pass computation.
Args:
inputs: Input tensor data sample.
Returns:
Output forward prediction tensor.
"""
return inputs
|