hippoformer 0.0.1__py3-none-any.whl → 0.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hippoformer/__init__.py +4 -0
- hippoformer/hippoformer.py +63 -3
- {hippoformer-0.0.1.dist-info → hippoformer-0.0.2.dist-info}/METADATA +1 -1
- hippoformer-0.0.2.dist-info/RECORD +6 -0
- hippoformer-0.0.1.dist-info/RECORD +0 -6
- {hippoformer-0.0.1.dist-info → hippoformer-0.0.2.dist-info}/WHEEL +0 -0
- {hippoformer-0.0.1.dist-info → hippoformer-0.0.2.dist-info}/licenses/LICENSE +0 -0
hippoformer/__init__.py
CHANGED
hippoformer/hippoformer.py
CHANGED
|
@@ -104,13 +104,73 @@ class PathIntegration(Module):
|
|
|
104
104
|
class mmTEM(Module):
|
|
105
105
|
def __init__(
|
|
106
106
|
self,
|
|
107
|
-
dim
|
|
107
|
+
dim,
|
|
108
|
+
*,
|
|
109
|
+
sensory_encoder: Module,
|
|
110
|
+
sensory_decoder: Module,
|
|
111
|
+
dim_sensory,
|
|
112
|
+
dim_action,
|
|
113
|
+
dim_encoded_sensory,
|
|
114
|
+
dim_structure,
|
|
115
|
+
meta_mlp_depth = 2,
|
|
116
|
+
decoder_mlp_depth = 2,
|
|
117
|
+
structure_variance_pred_mlp_depth = 2,
|
|
118
|
+
path_integrate_kwargs: dict = dict(),
|
|
119
|
+
loss_weight_generative = 1.,
|
|
120
|
+
loss_weight_inference = 1.,
|
|
121
|
+
loss_weight_consistency = 1.,
|
|
122
|
+
loss_weight_relational = 1.,
|
|
108
123
|
):
|
|
109
124
|
super().__init__()
|
|
110
125
|
|
|
126
|
+
dim_joint_rep = dim_encoded_sensory + dim_structure
|
|
127
|
+
|
|
128
|
+
# path integrator
|
|
129
|
+
|
|
130
|
+
self.path_integrator = PathIntegration(
|
|
131
|
+
dim_action = dim_action,
|
|
132
|
+
dim_structure = dim_structure,
|
|
133
|
+
**path_integrate_kwargs
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
# meta mlp related
|
|
137
|
+
|
|
138
|
+
self.to_queries = nn.Linear(dim_joint_rep, dim, bias = False)
|
|
139
|
+
self.to_keys = nn.Linear(dim_joint_rep, dim, bias = False)
|
|
140
|
+
self.to_values = nn.Linear(dim_joint_rep, dim, bias = False)
|
|
141
|
+
|
|
142
|
+
self.meta_mlp = create_mlp(
|
|
143
|
+
dim = dim * 2,
|
|
144
|
+
depth = meta_mlp_depth,
|
|
145
|
+
dim_in = dim,
|
|
146
|
+
dim_out = dim,
|
|
147
|
+
activation = nn.ReLU()
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# mlp decoder (from meta mlp output to joint)
|
|
151
|
+
|
|
152
|
+
self.meta_mlp_output_decoder = create_mlp(
|
|
153
|
+
dim = dim * 2,
|
|
154
|
+
dim_in = dim,
|
|
155
|
+
dim_out = dim_joint_rep,
|
|
156
|
+
depth = decoder_mlp_depth,
|
|
157
|
+
activation = nn.ReLU()
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
# the mlp that predicts the variance for the structural code
|
|
161
|
+
# for correcting the generated structural code modeling the feedback from HC to MEC
|
|
162
|
+
|
|
163
|
+
self.structure_variance_pred_mlp_depth = create_mlp(
|
|
164
|
+
dim = dim_structure * 2,
|
|
165
|
+
dim_in = dim_structure * 2 + 1,
|
|
166
|
+
dim_out = dim_structure,
|
|
167
|
+
depth = structure_variance_pred_mlp_depth
|
|
168
|
+
)
|
|
111
169
|
|
|
112
170
|
def forward(
|
|
113
171
|
self,
|
|
114
|
-
|
|
172
|
+
sensory,
|
|
173
|
+
actions
|
|
115
174
|
):
|
|
116
|
-
|
|
175
|
+
structural_codes = self.path_integrator(actions)
|
|
176
|
+
return structural_codes.sum()
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
hippoformer/__init__.py,sha256=A7N8GsRAZH4yP-L5hb7IVDnNjnhfjNyolg5MZ6vnGyE,71
|
|
2
|
+
hippoformer/hippoformer.py,sha256=yywVJJrrB1IilD_hGALRblBlBhoYGDPIYpwjNCvL3u8,4616
|
|
3
|
+
hippoformer-0.0.2.dist-info/METADATA,sha256=5E0PLeUouF-6iq8Zrw5sSuFP5xdHm0NYGlE7lyo2-ls,2773
|
|
4
|
+
hippoformer-0.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
+
hippoformer-0.0.2.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
|
|
6
|
+
hippoformer-0.0.2.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
hippoformer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
hippoformer/hippoformer.py,sha256=6tA4ZWYKbzclpeTUhJtr2OguVOyyAGFxuLf9bfnfO_M,2682
|
|
3
|
-
hippoformer-0.0.1.dist-info/METADATA,sha256=4hnfh1oIIlcGsIQ7qD7fZHWfM5ltnHhATAPcN-4vkxQ,2773
|
|
4
|
-
hippoformer-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
5
|
-
hippoformer-0.0.1.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
|
|
6
|
-
hippoformer-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|