MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / mode

Method mode

roach/models/distributions.py:255–273  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

253 return self.distribution.rsample()
254
255 def mode(self) -> th.Tensor:
256 alpha = self.distribution.concentration1
257 beta = self.distribution.concentration0
258 x = th.zeros_like(alpha)
259 x[:, 1] += 0.5
260 mask1 = (alpha > 1) & (beta > 1)
261 x[mask1] = (alpha[mask1]-1)/(alpha[mask1]+beta[mask1]-2)
262
263 mask2 = (alpha <= 1) & (beta > 1)
264 x[mask2] = 0.0
265
266 mask3 = (alpha > 1) & (beta <= 1)
267 x[mask3] = 1.0
268
269 # mean
270 mask4 = (alpha <= 1) & (beta <= 1)
271 x[mask4] = self.distribution.mean[mask4]
272
273 return x
274
275 def get_actions(self, deterministic: bool = False) -> th.Tensor:
276 if deterministic:

Callers 1

get_actionsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected