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

Function mark_volatile

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

Source from the content-addressed store, hash-verified

28 return np.array(obj)
29
30def mark_volatile(obj):
31 if torch.is_tensor(obj):
32 obj = Variable(obj)
33 if isinstance(obj, Variable):
34 obj.no_grad = True
35 return obj
36 elif isinstance(obj, collections.Mapping):
37 return {k: mark_volatile(o) for k, o in obj.items()}
38 elif isinstance(obj, collections.Sequence):
39 return [mark_volatile(o) for o in obj]
40 else:
41 return obj

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected