MCPcopy Create free account
hub / github.com/pytorch/tutorials / __init__

Method __init__

intermediate_source/mario_rl_tutorial.py:418–434  ·  view source on GitHub ↗
(self, input_dim, output_dim)

Source from the content-addressed store, hash-verified

416 """
417
418 def __init__(self, input_dim, output_dim):
419 super().__init__()
420 c, h, w = input_dim
421
422 if h != 84:
423 raise ValueError(f"Expecting input height: 84, got: {h}")
424 if w != 84:
425 raise ValueError(f"Expecting input width: 84, got: {w}")
426
427 self.online = self.__build_cnn(c, output_dim)
428
429 self.target = self.__build_cnn(c, output_dim)
430 self.target.load_state_dict(self.online.state_dict())
431
432 # Q_target parameters are frozen.
433 for p in self.target.parameters():
434 p.requires_grad = False
435
436 def forward(self, input, model):
437 if model == "online":

Callers

nothing calls this directly

Calls 2

__build_cnnMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected