MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / as_variable

Function as_variable

lib/utils/th.py:8–16  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

6__all__ = ['as_variable', 'as_numpy', 'mark_volatile']
7
8def as_variable(obj):
9 if isinstance(obj, Variable):
10 return obj
11 if isinstance(obj, collections.Sequence):
12 return [as_variable(v) for v in obj]
13 elif isinstance(obj, collections.Mapping):
14 return {k: as_variable(v) for k, v in obj.items()}
15 else:
16 return Variable(obj)
17
18def as_numpy(obj):
19 if isinstance(obj, collections.Sequence):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected