(cls, storage, metadata)
| 111 | |
| 112 | |
| 113 | def rebuild_tensor(cls, storage, metadata): |
| 114 | storage_offset, size, stride, requires_grad = metadata |
| 115 | t = torch._utils._rebuild_tensor(storage, storage_offset, size, stride) |
| 116 | if cls == torch.nn.parameter.Parameter: |
| 117 | # we have to pass requires_grad into constructor, rather than set it as an |
| 118 | # attribute later, because it's an important check for Integer Tensors to |
| 119 | # have requires_grad=False (or else they raise an error) |
| 120 | t = torch.nn.parameter.Parameter(t, requires_grad=requires_grad) |
| 121 | else: |
| 122 | t.requires_grad = requires_grad |
| 123 | return t |
| 124 | |
| 125 | |
| 126 | def rebuild_meta_tensor( |
nothing calls this directly
no outgoing calls
no test coverage detected