(obj)
| 28 | return np.array(obj) |
| 29 | |
| 30 | def 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 |
nothing calls this directly
no outgoing calls
no test coverage detected