evolutionary-policy-optimization 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.
@@ -207,6 +207,7 @@ class LatentGenePool(Module):
207
207
  if l2norm_latent:
208
208
  latents = maybe_l2norm(latents, dim = -1)
209
209
 
210
+ self.num_latents = num_latents
210
211
  self.latents = nn.Parameter(latents, requires_grad = False)
211
212
 
212
213
  self.maybe_l2norm = maybe_l2norm
@@ -248,6 +249,7 @@ class LatentGenePool(Module):
248
249
  p - population
249
250
  g - gene dimension
250
251
  """
252
+ assert self.num_latents > 1
251
253
 
252
254
  genes = self.latents # the latents are the genes
253
255
 
@@ -309,14 +311,21 @@ class LatentGenePool(Module):
309
311
  def forward(
310
312
  self,
311
313
  *args,
312
- latent_id: int,
314
+ latent_id: int | None = None,
313
315
  **kwargs,
314
316
  ):
315
317
 
316
318
  assert exists(self.net)
317
319
 
320
+ # if only 1 latent, assume doing ablation and get lone gene
321
+
322
+ if self.num_latents == 1:
323
+ latent_id = 0
324
+
318
325
  assert 0 <= latent_id < self.num_latents
319
326
 
327
+ # fetch latent
328
+
320
329
  latent = self.latents[latent_id]
321
330
 
322
331
  return self.net(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: evolutionary-policy-optimization
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: EPO - Pytorch
5
5
  Project-URL: Homepage, https://pypi.org/project/evolutionary-policy-optimization/
6
6
  Project-URL: Repository, https://github.com/lucidrains/evolutionary-policy-optimization
@@ -0,0 +1,7 @@
1
+ evolutionary_policy_optimization/__init__.py,sha256=Nu-_OMA8abe4AiW9Gw6MvbZH0JZpMHMqjeXmkC9-7UU,81
2
+ evolutionary_policy_optimization/epo.py,sha256=6IcrAooUY8csFMv4ho5bf6TVAsk1cYyXB5hG3NA-jbA,9941
3
+ evolutionary_policy_optimization/experimental.py,sha256=ktBKxRF27Qsj7WIgBpYlWXqMVxO9zOx2oD1JuDYRAwM,548
4
+ evolutionary_policy_optimization-0.0.2.dist-info/METADATA,sha256=XqR4EZUWWXRjskU3_eHlwNzCeEddjm20un4E04xmNLk,4072
5
+ evolutionary_policy_optimization-0.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ evolutionary_policy_optimization-0.0.2.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
7
+ evolutionary_policy_optimization-0.0.2.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- evolutionary_policy_optimization/__init__.py,sha256=Nu-_OMA8abe4AiW9Gw6MvbZH0JZpMHMqjeXmkC9-7UU,81
2
- evolutionary_policy_optimization/epo.py,sha256=todzxq4nLnkYhrFByP3DDeq5KpkLTxtq3Rz4VTFK59o,9698
3
- evolutionary_policy_optimization/experimental.py,sha256=ktBKxRF27Qsj7WIgBpYlWXqMVxO9zOx2oD1JuDYRAwM,548
4
- evolutionary_policy_optimization-0.0.1.dist-info/METADATA,sha256=IEhBeiiVRsY0mj--DLn2-dT0MtLg2mSGsbU24mXq0vE,4072
5
- evolutionary_policy_optimization-0.0.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
- evolutionary_policy_optimization-0.0.1.dist-info/licenses/LICENSE,sha256=1yCiA9b5nhslTavxPjsQAO-wpOnwJR9-l8LTVi7GJuk,1066
7
- evolutionary_policy_optimization-0.0.1.dist-info/RECORD,,