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

Function make_composite_from_td

advanced_source/pendulum.py:438–452  ·  view source on GitHub ↗
(td)

Source from the content-addressed store, hash-verified

436
437
438def make_composite_from_td(td):
439 # custom function to convert a ``tensordict`` in a similar spec structure
440 # of unbounded values.
441 composite = CompositeSpec(
442 {
443 key: make_composite_from_td(tensor)
444 if isinstance(tensor, TensorDictBase)
445 else UnboundedContinuousTensorSpec(
446 dtype=tensor.dtype, device=tensor.device, shape=tensor.shape
447 )
448 for key, tensor in td.items()
449 },
450 shape=td.shape,
451 )
452 return composite
453
454
455######################################################################

Callers 1

_make_specFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected