Skip to content

Commit 6bbd370

Browse files
authored
Merge pull request pytorch#30 from SsnL/module_name_dot
Update migration guide on new constraints of module/buffer/parameter names
2 parents 86d902b + b29900f commit 6bbd370

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

_posts/2018-04-22-0_4_0-migration-guide.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Welcome to the migration guide for PyTorch 0.4.0. In this release we introduced
1111
* Deprecation of the ``volatile`` flag
1212
* ``dtypes``, ``devices``, and Numpy-style ``Tensor`` creation functions
1313
* Writing device-agnostic code
14+
* New edge-case constraints on names of submodules, parameters, and buffers in ``nn.Module``
1415

1516

1617
## Merging [``Tensor``](http://pytorch.org/docs/0.4.0/tensors.html) and ``Variable`` and classes
@@ -299,6 +300,10 @@ input = data.to(device)
299300
model = MyModule(...).to(device)
300301
```
301302

303+
## New edge-case constraints on names of submodules, parameters, and buffers in ``nn.Module``
304+
305+
`name` that is an empty string or contains `"."` is no longer permitted in `module.add_module(name, value)`, `module.add_parameter(name, value)` or `module.add_buffer(name, value)` because such names may cause lost data in the `state_dict`. If you are loading a checkpoint for modules containing such names, please update the module definition and patch the `state_dict` before loading it.
306+
302307
## Code Samples (Putting it all together)
303308

304309
To get a flavor of the overall recommended changes in 0.4.0, let's look at a quick example for a common code pattern in both 0.3.1 and 0.4.0:

0 commit comments

Comments
 (0)