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

Function _init

advanced_source/coding_ddpg.py:188–213  ·  view source on GitHub ↗
(
    self,
    actor_network: TensorDictModule,
    value_network: TensorDictModule,
)

Source from the content-addressed store, hash-verified

186
187
188def _init(
189 self,
190 actor_network: TensorDictModule,
191 value_network: TensorDictModule,
192) -> None:
193 super(type(self), self).__init__()
194
195 self.convert_to_functional(
196 actor_network,
197 "actor_network",
198 create_target_params=True,
199 )
200 self.convert_to_functional(
201 value_network,
202 "value_network",
203 create_target_params=True,
204 compare_against=list(actor_network.parameters()),
205 )
206
207 self.actor_in_keys = actor_network.in_keys
208
209 # Since the value we'll be using is based on the actor and value network,
210 # we put them together in a single actor-critic container.
211 actor_critic = ActorCriticWrapper(actor_network, value_network)
212 self.actor_critic = actor_critic
213 self.loss_function = "l2"
214
215
216###############################################################################

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected