Skip to content

Instantly share code, notes, and snippets.

@keivalya
Created December 16, 2025 16:03
Show Gist options
  • Select an option

  • Save keivalya/58f8ec4468034e5362692523349331bf to your computer and use it in GitHub Desktop.

Select an option

Save keivalya/58f8ec4468034e5362692523349331bf to your computer and use it in GitHub Desktop.
Robot State Encoder.
# Encoding robot state using a simple Multi-Layer Perceptron
class StateEncoderMLP(nn.Module):
def __init__(self, state_dim, d_model=128):
super().__init__()
self.net = nn.Sequential(
nn.Linear(state_dim, 64),
nn.ReLU(),
nn.Linear(64, d_model),
)
self.ln = nn.LayerNorm(d_model)
def forward(self, s):
x = self.net(s)
x = self.ln(x)
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment