MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / init_weights

Method init_weights

roach/models/ppo_policy.py:243–250  ·  view source on GitHub ↗

Orthogonal initialization (used in PPO and A2C)

(module: nn.Module, gain: float = 1)

Source from the content-addressed store, hash-verified

241
242 @staticmethod
243 def init_weights(module: nn.Module, gain: float = 1) -> None:
244 """
245 Orthogonal initialization (used in PPO and A2C)
246 """
247 if isinstance(module, (nn.Linear, nn.Conv2d)):
248 nn.init.orthogonal_(module.weight, gain=gain)
249 if module.bias is not None:
250 module.bias.data.fill_(0.0)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected