unitorch.models.swin¤
SwinProcessor¤
Bases: HfImageClassificationProcessor
Initializes the SwinProcessor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vision_config_path
|
str
|
Path to the ViTImageProcessor configuration file. |
required |
Source code in src/unitorch/models/swin/processing.py
10 11 12 13 14 15 16 17 18 19 20 21 | |
SwinForImageClassification¤
Bases: GenericModel
Initializes the SwinForImageClassification model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_path
|
str
|
Path to the Swin Transformer configuration file. |
required |
num_classes
|
int
|
Number of output classes. Defaults to 1. |
1
|
Source code in src/unitorch/models/swin/modeling.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
forward ¤
forward(pixel_values: Tensor)
Forward pass of the SwinForImageClassification model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pixel_values
|
Tensor
|
Input image pixel values. |
required |
Returns:
| Type | Description |
|---|---|
|
torch.Tensor: Classification logits. |
Source code in src/unitorch/models/swin/modeling.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | |