Returns a cloned network object. :return: A copy of this network.
(self)
| 197 | torch.save(self, open(file_name, "wb")) |
| 198 | |
| 199 | def clone(self) -> "Network": |
| 200 | # language=rst |
| 201 | """ |
| 202 | Returns a cloned network object. |
| 203 | |
| 204 | :return: A copy of this network. |
| 205 | """ |
| 206 | virtual_file = tempfile.SpooledTemporaryFile() |
| 207 | torch.save(self, virtual_file) |
| 208 | virtual_file.seek(0) |
| 209 | return torch.load(virtual_file) |
| 210 | |
| 211 | def _get_inputs(self, layers: Iterable = None) -> Dict[str, torch.Tensor]: |
| 212 | # language=rst |