gym-examples 3.0.404__py3-none-any.whl → 3.0.406__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.
gym_examples/__init__.py CHANGED
@@ -5,4 +5,4 @@ register(
5
5
  entry_point="gym_examples.envs:WSNRoutingEnv",
6
6
  )
7
7
 
8
- __version__ = "3.0.404"
8
+ __version__ = "3.0.406"
@@ -54,21 +54,28 @@ max_reward = 1 # maximum reward value when the sensors sent data to the base sta
54
54
  # net = Attention(input_dim, output_dim)
55
55
  # net = net.double() # Convert the weights to Double
56
56
 
57
+ import torch
58
+ import torch.nn as nn
59
+ from gaussian_adaptive_attention import GaussianAdaptiveAttention # Ensure this is properly imported
60
+
57
61
  class ScalarAttentionModel(nn.Module):
58
- def __init__(self, input_dim):
62
+ def __init__(self, input_dim=4, output_dim=1):
59
63
  super(ScalarAttentionModel, self).__init__()
60
64
  # Initialize GaussianAdaptiveAttention
61
65
  self.ga_attention = GaussianAdaptiveAttention(
62
- num_heads=1, # Single head for simplicity
63
- num_gaussians=4, # Corresponds to your input length
64
- attention_axis=0, # Attention along the first axis
66
+ norm_axis=1, # Normalize along feature axis
67
+ num_heads=1, # Single head for simplicity
68
+ num_gaussians=input_dim, # Match input length
69
+ padding_value=None, # Change if padding exists
65
70
  )
66
- self.output_layer = nn.Linear(input_dim, 1) # Map to scalar output
71
+ self.output_layer = nn.Linear(input_dim, output_dim) # Map to scalar output
67
72
 
68
73
  def forward(self, x):
74
+ # Ensure input is 2D
75
+ if x.dim() == 1:
76
+ x = x.unsqueeze(0) # Add batch dimension if necessary
69
77
  # Apply GaussianAdaptiveAttention
70
- attention_output = self.ga_attention(x.unsqueeze(0)) # Add batch dim
71
- attention_output = attention_output.squeeze(0) # Remove batch dim
78
+ attention_output = self.ga_attention(x)
72
79
  # Map to scalar
73
80
  scalar_output = self.output_layer(attention_output)
74
81
  return scalar_output
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gym-examples
3
- Version: 3.0.404
3
+ Version: 3.0.406
4
4
  Summary: A custom environment for multi-agent reinforcement learning focused on WSN routing.
5
5
  Home-page: https://github.com/gedji/CODES.git
6
6
  Author: Georges Djimefo
@@ -0,0 +1,7 @@
1
+ gym_examples/__init__.py,sha256=93ZP0az3WubSxQddsv4ZBMSOcGLaybt50oMK3bVh0Ls,166
2
+ gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
+ gym_examples/envs/wsn_env.py,sha256=pJVSjoGOfXumb5E_74ArsFywoh4BqGlV5azKU3qAbIw,27591
4
+ gym_examples-3.0.406.dist-info/METADATA,sha256=ZN3X9fGxl0OwSzdtDLcSucYFzOUKUEXKnk3lb1-K_II,412
5
+ gym_examples-3.0.406.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
+ gym_examples-3.0.406.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
+ gym_examples-3.0.406.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- gym_examples/__init__.py,sha256=kSSUOydEpYd6p-FwjBNXhpeRAH5NAZ7lXf2MEHD66RE,166
2
- gym_examples/envs/__init__.py,sha256=lgMe4pyOuUTgTBUddM0iwMlETsYTwFShny6ifm8PGM8,53
3
- gym_examples/envs/wsn_env.py,sha256=hLM8UtyVrLn-dm_8ZazOjR_iuBk9mLxzCwRRsIbopWs,27341
4
- gym_examples-3.0.404.dist-info/METADATA,sha256=vrZnbnEa5pzhM2LTWiayHm5fMGebm-KKeVxMyBG_yuE,412
5
- gym_examples-3.0.404.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
6
- gym_examples-3.0.404.dist-info/top_level.txt,sha256=rJRksoAF32M6lTLBEwYzRdo4PgtejceaNnnZ3HeY_Rk,13
7
- gym_examples-3.0.404.dist-info/RECORD,,