Skip to content

Commit

Permalink
DOFA: save parameters as instance attributes (#2346)
Browse files Browse the repository at this point in the history
* add embed_dim as attr

* also add depth

* add other attributes

* move params

* order
  • Loading branch information
nilsleh authored Oct 14, 2024
1 parent 6a84a61 commit 6f72b3d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions torchgeo/models/dofa.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ def __init__(
num_layers: Number of layers.
"""
super().__init__()

self.input_dim = input_dim
self.output_dim = output_dim
self.embed_dim = embed_dim
self.num_heads = num_heads
self.num_layers = num_layers

encoder_layer = nn.TransformerEncoderLayer(
d_model=input_dim,
nhead=num_heads,
Expand Down Expand Up @@ -267,8 +274,17 @@ def __init__(
"""
super().__init__()

self.img_size = img_size
self.patch_size = patch_size
self.drop_rate = drop_rate
self.embed_dim = embed_dim
self.depth = depth
self.num_heads = num_heads
self.dynamic_embed_dim = dynamic_embed_dim
self.num_classes = num_classes
self.global_pool = global_pool
self.mlp_ratio = mlp_ratio

if self.global_pool:
norm_layer = norm_layer
embed_dim = embed_dim
Expand Down

0 comments on commit 6f72b3d

Please sign in to comment.