Skip to content

Commit 7dc140b

Browse files
Merge pull request #486 from NiklasGustafsson/main
Release preparation. Updating version number.
2 parents be6a38f + fe95202 commit 7dc140b

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

RELEASENOTES.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
## TorchSharp Release Notes
22

33
Releases, starting with 9/2/2021, are listed with the most recent release at the top.
4+
45
## NuGet Version 0.95.4
56

67
__API Changes:__
78

9+
Added OneCycleLR and CyclicLR schedulers
810
Added DisposeScopeManager and torch.NewDisposeScope() to facilitate a new solution for managing disposing of tensors with fewer usings.
11+
Added Tensor.set_()
12+
Added 'copy' argument to Tensor.to()
913

1014
__Fixed Bugs:__
1115

16+
#476 BatchNorm does not expose bias,weight,running_mean,running_var
17+
#475 Loading Module that's on CUDA
18+
#372 Module.save moves Module to CPU
19+
#468 How to set Conv2d kernel_size=(2,300)
20+
#450 Smoother disposing
1221

1322
### NuGet Version 0.95.3
1423

build/BranchInfo.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<PropertyGroup>
33
<MajorVersion>0</MajorVersion>
44
<MinorVersion>95</MinorVersion>
5-
<PatchVersion>3</PatchVersion>
5+
<PatchVersion>4</PatchVersion>
66
</PropertyGroup>
77

88
</Project>

docfx/articles/saveload.md

+2-8
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Python pickling is intimately coupled to Python and its runtime object model. It
2121

2222
In order to share models between .NET applications, Python pickling is not at all necessary, and even for moving model state from Python to .NET, it is overkill. The state of a model is a simple dictionary where the keys are strings and the values are tensors.
2323

24-
Therefore, TorchSharp in its current form, implements its own very simple model serialization format, which allows models originating in either .NET or Python to be loaded using .NET, as long as the model was saved using the special format.
24+
Therefore, TorchSharp, in its current form, implements its own very simple model serialization format, which allows models originating in either .NET or Python to be loaded using .NET, as long as the model was saved using the special format.
2525

2626
The MNIST and AdversarialExampleGeneration examples in this repo rely on saving and restoring model state -- the latter example relies on a pre-trained model from MNST.
2727

@@ -35,20 +35,14 @@ In C#, saving a model looks like this:
3535
model.save("model_weights.dat");
3636
```
3737

38-
It's important to note that calling 'save' will move the model to the CPU, where it remains after the call. If you need to continue to use the model after saving it, you will have to explicitly move it back:
39-
40-
```C#
41-
model.to(Device.CUDA);
42-
```
43-
4438
And loading it again is done by:
4539

4640
```C#
4741
model = [...];
4842
model.load("model_weights.dat");
4943
```
5044

51-
The model should be created on the CPU before loading weights, then moved to the target device.
45+
For efficient memory management, the model should be created on the CPU before loading weights, then moved to the target device.
5246

5347
><br/>It is __critical__ that all submodules and buffers in a custom module or composed by a Sequential object have exactly the same name in the original and target models, since that is how persisted tensors are associated with the model into which they are loaded.<br/><br/>The CustomModule 'RegisterComponents' will automatically find all fields that are either modules or tensors, register the former as modules, and the latter as buffers. It registers all of these using the name of the field, just like the PyTorch Module base class does.<br/><br/>
5448

0 commit comments

Comments
 (0)