MCPcopy Index your code
hub / github.com/pytorch/tutorials / SinTransform

Class SinTransform

advanced_source/pendulum.py:675–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673
674
675class SinTransform(Transform):
676 def _apply_transform(self, obs: torch.Tensor) -> None:
677 return obs.sin()
678
679 # The transform must also modify the data at reset time
680 def _reset(
681 self, tensordict: TensorDictBase, tensordict_reset: TensorDictBase
682 ) -> TensorDictBase:
683 return self._call(tensordict_reset)
684
685 # _apply_to_composite will execute the observation spec transform across all
686 # in_keys/out_keys pairs and write the result in the observation_spec which
687 # is of type ``Composite``
688 @_apply_to_composite
689 def transform_observation_spec(self, observation_spec):
690 return BoundedTensorSpec(
691 low=-1,
692 high=1,
693 shape=observation_spec.shape,
694 dtype=observation_spec.dtype,
695 device=observation_spec.device,
696 )
697
698
699class CosTransform(Transform):

Callers 1

pendulum.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected