Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving more modules to C#. #1259

Closed
wants to merge 217 commits into from
Closed
Show file tree
Hide file tree
Changes from 215 commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
39aa1c5
Override 'Module._to()' overloads on some modules that do not have bu…
NiklasGustafsson Feb 27, 2023
7b0350a
Shortcircuit '_to()' for modules that are known not to have buffers o…
NiklasGustafsson Feb 28, 2023
534baaa
Experimental rewrite of some modules.
NiklasGustafsson Mar 3, 2023
ae18c5e
Merge branch 'main' into unit
NiklasGustafsson Mar 6, 2023
7b89432
Slight modification to the experimental re-implementation of Linear.
NiklasGustafsson Mar 6, 2023
4c25d33
Merge branch 'missing' into unit
NiklasGustafsson Mar 6, 2023
bf32faf
Implemented a number of modules as managed code calling into function…
NiklasGustafsson Mar 7, 2023
6316f0f
Merge branch 'main' into unit
NiklasGustafsson Mar 7, 2023
d5b64d3
More modules implemented without native module instances
NiklasGustafsson Mar 7, 2023
0228eb5
Merge branch 'main' into unit
NiklasGustafsson Mar 8, 2023
16cfbc3
Merge branch 'main' into unit
NiklasGustafsson Mar 13, 2023
f844cd5
Merge branch 'main' into unit
NiklasGustafsson Mar 14, 2023
cfaea64
Merge branch 'main' into unit
NiklasGustafsson Mar 17, 2023
06c9ac7
Merge branch 'main' into unit
NiklasGustafsson Mar 27, 2023
4778090
Merge branch 'main' into unit
NiklasGustafsson Mar 27, 2023
339e381
Fixed infinite recursion in bilinear.
NiklasGustafsson Mar 27, 2023
a5f7514
Merge branch 'unit' of https://github.com/NiklasGustafsson/TorchSharp…
NiklasGustafsson Mar 27, 2023
b1ff253
Merge branch 'main' into unit
NiklasGustafsson Mar 28, 2023
3419f73
Merge branch 'main' into unit
NiklasGustafsson Mar 28, 2023
eeba298
Merge branch 'unit' of https://github.com/NiklasGustafsson/TorchSharp…
NiklasGustafsson Mar 30, 2023
0108153
Merge branch 'main' into unit
Apr 4, 2023
a771c6e
Merge branch 'main' into unit
NiklasGustafsson Apr 10, 2023
0130a1d
Merge branch 'unit' of https://github.com/NiklasGustafsson/TorchSharp…
NiklasGustafsson Apr 10, 2023
1dba6d1
Merge branch 'main' into unit
NiklasGustafsson Apr 24, 2023
0f8122f
Merge branch 'main' into unit
NiklasGustafsson Apr 25, 2023
c617c1c
Merge branch 'main' into unit
NiklasGustafsson Apr 26, 2023
0d9132e
Merge branch 'main' into unit
NiklasGustafsson Apr 27, 2023
3c876ef
Merge branch 'main' into unit
NiklasGustafsson Apr 28, 2023
c017dbc
Merge branch 'main' into unit
NiklasGustafsson May 8, 2023
86f22c4
Merge branch 'main' into unit
NiklasGustafsson May 9, 2023
0397f47
Merge branch 'main' into unit
NiklasGustafsson May 9, 2023
5d3e664
Manual merge
NiklasGustafsson May 17, 2023
13761a4
Manual merge
NiklasGustafsson May 18, 2023
e311a07
Corrected faulty merge.
NiklasGustafsson May 18, 2023
0a448cd
Merge branch 'main' into unit
NiklasGustafsson May 24, 2023
0ad47e4
Merge branch 'main' into unit
NiklasGustafsson May 30, 2023
4bb03e7
Merge branch 'main' into unit
Jun 5, 2023
3df1dba
Merge branch 'main' into unit
NiklasGustafsson Jun 12, 2023
577bb38
Merge branch 'main' into unit
NiklasGustafsson Jun 14, 2023
e50ad22
Merge branch 'main' into unit
Jun 21, 2023
2faa5ab
Merge branch 'main' into unit
Jun 23, 2023
2cfde4e
Adding more VS Copilot-driven unit tests for TV.
Jun 23, 2023
c0a38e6
More unit tests
Jun 23, 2023
7730748
Merge branch 'main' into torchvision
Jun 24, 2023
dec12cf
Merge branch 'main' into unit
Jun 24, 2023
a503fd2
Merge branch 'main' into torchvision
Jun 25, 2023
0d6b180
Merge branch 'main' into unit
Jun 25, 2023
2c61850
Merge branch 'main' into torchvision
NiklasGustafsson Jun 27, 2023
e8e47d6
Merge branch 'main' into unit
NiklasGustafsson Jun 27, 2023
e86cd12
Merge branch 'main' into torchvision
NiklasGustafsson Jul 12, 2023
162d613
Merge branch 'main' into unit
NiklasGustafsson Jul 12, 2023
25ab128
Merge branch 'main' into torchvision
NiklasGustafsson Jul 14, 2023
25b20ea
Merge branch 'main' into unit
NiklasGustafsson Jul 14, 2023
6e6d48e
Merge branch 'main' into torchvision
NiklasGustafsson Jul 17, 2023
55e96d7
Merge branch 'main' into unit
NiklasGustafsson Jul 17, 2023
5ed9c20
Merge branch 'main' into torchvision
NiklasGustafsson Jul 20, 2023
5906909
Merge branch 'main' into unit
NiklasGustafsson Jul 20, 2023
8828f4b
Merge branch 'main' into torchvision
NiklasGustafsson Aug 8, 2023
1a8263b
Merge branch 'main' into unit
NiklasGustafsson Aug 8, 2023
f95fb9a
Merge branch 'main' into torchvision
NiklasGustafsson Aug 9, 2023
db20fcd
Merge branch 'main' into unit
NiklasGustafsson Aug 9, 2023
9ad026f
Merge branch 'main' into torchvision
NiklasGustafsson Aug 9, 2023
93c1efc
Merge branch 'main' into unit
NiklasGustafsson Aug 9, 2023
3d73426
Manual merges
NiklasGustafsson Aug 9, 2023
e6c5b0d
Manual merge
NiklasGustafsson Aug 9, 2023
889a906
Merge branch 'main' into unit
NiklasGustafsson Aug 9, 2023
7301f04
Merge branch 'main' into torchvision
NiklasGustafsson Aug 10, 2023
b5c8ae7
Merge branch 'main' into unit
NiklasGustafsson Aug 10, 2023
7c8d73a
Merge branch 'main' into torchvision
NiklasGustafsson Aug 10, 2023
fecb310
Merge branch 'main' into unit
NiklasGustafsson Aug 10, 2023
58aa38a
Merge branch 'main' into torchvision
NiklasGustafsson Aug 10, 2023
678ed3b
Merge branch 'main' into unit
NiklasGustafsson Aug 10, 2023
6ca94fa
Merge branch 'main' into torchvision
NiklasGustafsson Aug 11, 2023
1abc324
Merge branch 'main' into unit
NiklasGustafsson Aug 11, 2023
4d6515e
Merge branch 'main' into torchvision
NiklasGustafsson Aug 14, 2023
8afc8d6
Merge branch 'main' into unit
NiklasGustafsson Aug 14, 2023
99a69a9
Merge branch 'main' into torchvision
NiklasGustafsson Aug 15, 2023
e17eb31
Merge branch 'main' into unit
NiklasGustafsson Aug 15, 2023
a8e1d90
Merge branch 'main' into torchvision
NiklasGustafsson Aug 15, 2023
53be92f
Merge branch 'main' into unit
NiklasGustafsson Aug 15, 2023
bf39a68
Merge branch 'main' into torchvision
NiklasGustafsson Aug 16, 2023
a341978
Merge branch 'main' into unit
NiklasGustafsson Aug 16, 2023
f81e4a6
Merge branch 'main' into torchvision
NiklasGustafsson Aug 17, 2023
53a20bb
Merge branch 'main' into unit
NiklasGustafsson Aug 17, 2023
5d6eab3
Merge branch 'main' into torchvision
NiklasGustafsson Aug 29, 2023
f4c688e
Merge branch 'main' into unit
NiklasGustafsson Aug 29, 2023
df02776
Merge branch 'main' into torchvision
NiklasGustafsson Aug 29, 2023
2fd482d
Merge branch 'main' into unit
NiklasGustafsson Aug 29, 2023
b4054f0
Merge branch 'main' into torchvision
NiklasGustafsson Aug 31, 2023
b2c69ed
Merge branch 'main' into unit
NiklasGustafsson Aug 31, 2023
472c56f
Merge branch 'main' into torchvision
NiklasGustafsson Sep 7, 2023
b91dd85
Merge branch 'main' into unit
NiklasGustafsson Sep 7, 2023
9244d9e
Merge branch 'main' into torchvision
NiklasGustafsson Sep 8, 2023
c3fe4e6
Merge branch 'main' into unit
NiklasGustafsson Sep 8, 2023
88bab20
Merge branch 'main' into torchvision
NiklasGustafsson Sep 21, 2023
89286f4
Merge branch 'main' into unit
NiklasGustafsson Sep 21, 2023
3971f0b
Merge branch 'main' into torchvision
NiklasGustafsson Oct 9, 2023
d50b4e9
Merge branch 'main' into unit
NiklasGustafsson Oct 9, 2023
6cf95c3
Merge branch 'main' into torchvision
NiklasGustafsson Oct 17, 2023
375202a
Merge branch 'main' into unit
NiklasGustafsson Oct 17, 2023
a632356
Merge branch 'main' into torchvision
NiklasGustafsson Oct 19, 2023
153e279
Merge branch 'main' into unit
NiklasGustafsson Oct 19, 2023
439b79c
Merge branch 'main' into torchvision
NiklasGustafsson Oct 20, 2023
c9b446a
Merge branch 'main' into unit
NiklasGustafsson Oct 20, 2023
e13e3ec
Merge branch 'main' into torchvision
NiklasGustafsson Oct 23, 2023
1a87010
Manual merge
NiklasGustafsson Oct 23, 2023
7c63275
Merge branch 'main' into torchvision
NiklasGustafsson Oct 23, 2023
5c2e771
Merge branch 'main' into unit
NiklasGustafsson Oct 23, 2023
0d622f7
Merge branch 'main' into torchvision
NiklasGustafsson Oct 23, 2023
4081615
Merge branch 'main' into unit
NiklasGustafsson Oct 23, 2023
9bcb3d6
Merge branch 'main' into torchvision
NiklasGustafsson Oct 23, 2023
9c741c8
Merge branch 'main' into unit
NiklasGustafsson Oct 23, 2023
69ae1a0
Merge branch 'main' into torchvision
NiklasGustafsson Oct 24, 2023
26eff10
Merge branch 'main' into unit
NiklasGustafsson Oct 24, 2023
e58ed85
Merge branch 'main' into torchvision
NiklasGustafsson Nov 2, 2023
d5d7a25
Merge branch 'main' into unit
NiklasGustafsson Nov 2, 2023
fc85494
Merge branch 'main' into torchvision
NiklasGustafsson Nov 2, 2023
511b544
Merge branch 'main' into unit
NiklasGustafsson Nov 2, 2023
eeeb69a
Merge branch 'main' into torchvision
NiklasGustafsson Nov 6, 2023
d9e1d81
Merge branch 'main' into unit
NiklasGustafsson Nov 6, 2023
5491976
Merge branch 'main' into torchvision
NiklasGustafsson Nov 9, 2023
1bf6120
Merge branch 'main' into unit
NiklasGustafsson Nov 9, 2023
fd5aefa
Merge branch 'main' into torchvision
NiklasGustafsson Nov 10, 2023
0fd9729
Merge branch 'main' into unit
NiklasGustafsson Nov 10, 2023
cd841d2
Merge branch 'main' into torchvision
NiklasGustafsson Nov 21, 2023
272eb24
Merge branch 'main' into unit
NiklasGustafsson Nov 21, 2023
1db7664
Merge branch 'main' into torchvision
NiklasGustafsson Nov 27, 2023
6eb34ca
Merge branch 'main' into unit
NiklasGustafsson Nov 27, 2023
38711cb
Merge branch 'main' into torchvision
NiklasGustafsson Nov 27, 2023
ef57e9d
Merge branch 'main' into unit
NiklasGustafsson Nov 27, 2023
66a6115
Merge branch 'main' into torchvision
NiklasGustafsson Nov 28, 2023
cd94263
Merge branch 'main' into unit
NiklasGustafsson Nov 28, 2023
677ae9e
Merge branch 'main' into torchvision
NiklasGustafsson Nov 29, 2023
1c36534
Merge branch 'main' into unit
NiklasGustafsson Nov 29, 2023
b696cb9
Merge branch 'main' into torchvision
NiklasGustafsson Nov 29, 2023
7b6c5fe
Merge branch 'main' into unit
NiklasGustafsson Nov 29, 2023
8163e9e
Merge branch 'main' into torchvision
NiklasGustafsson Dec 1, 2023
a496721
Merge branch 'main' into unit
NiklasGustafsson Dec 1, 2023
4136825
Merge branch 'main' into torchvision
NiklasGustafsson Dec 1, 2023
2567bc4
Manual merge
NiklasGustafsson Dec 1, 2023
a05d94d
Merge branch 'main' into torchvision
NiklasGustafsson Dec 1, 2023
fdaa7a9
Merge branch 'main' into unit
NiklasGustafsson Dec 1, 2023
5f76d78
Merge branch 'main' into torchvision
NiklasGustafsson Dec 4, 2023
11ad7f2
Merge branch 'main' into unit
NiklasGustafsson Dec 4, 2023
78943f3
Merge branch 'main' into torchvision
NiklasGustafsson Dec 7, 2023
6c10bc6
Merge branch 'main' into unit
NiklasGustafsson Dec 7, 2023
4b0c61c
Merge branch 'main' into torchvision
NiklasGustafsson Dec 7, 2023
0e7e33a
Merge branch 'main' into unit
NiklasGustafsson Dec 7, 2023
363b63f
Merge branch 'main' into torchvision
NiklasGustafsson Dec 11, 2023
9ff7231
Merge branch 'main' into unit
NiklasGustafsson Dec 11, 2023
ed09b63
Merge branch 'main' into torchvision
NiklasGustafsson Dec 12, 2023
4e8fe39
Merge branch 'main' into unit
NiklasGustafsson Dec 12, 2023
79b4542
Merge branch 'main' into torchvision
NiklasGustafsson Dec 12, 2023
658a11a
Merge branch 'main' into unit
NiklasGustafsson Dec 12, 2023
08335b1
Merge branch 'main' into torchvision
NiklasGustafsson Dec 20, 2023
59b4304
Merge branch 'main' into unit
NiklasGustafsson Dec 20, 2023
e67c7c1
Merge branch 'main' into torchvision
NiklasGustafsson Jan 19, 2024
bcfe3da
Merge branch 'main' into unit
NiklasGustafsson Jan 19, 2024
a2dc9cb
Merge branch 'main' into torchvision
NiklasGustafsson Jan 26, 2024
111ff89
Merge branch 'main' into unit
NiklasGustafsson Jan 26, 2024
86ffcfd
Stashing my changes.
NiklasGustafsson Feb 2, 2024
22c7e5f
Merge branch 'main' into torchvision
NiklasGustafsson Feb 2, 2024
f5cac11
Merge branch 'main' into unit
NiklasGustafsson Feb 2, 2024
f5eacb6
Merge branch 'main' into torchvision
NiklasGustafsson Feb 7, 2024
42fe2f4
Merge branch 'main' into unit
NiklasGustafsson Feb 7, 2024
6c30fdc
Merge branch 'main' into torchvision
NiklasGustafsson Feb 7, 2024
fccd005
Merge branch 'main' into unit
NiklasGustafsson Feb 7, 2024
8eb3315
Merge branch 'main' into torchvision
NiklasGustafsson Feb 9, 2024
7dec447
Merge branch 'main' into unit
NiklasGustafsson Feb 9, 2024
a6e94cd
Merge branch 'main' into torchvision
NiklasGustafsson Feb 14, 2024
ce76e55
Merge branch 'main' into unit
NiklasGustafsson Feb 14, 2024
431b816
Merge branch 'main' into torchvision
NiklasGustafsson Feb 22, 2024
8392b2f
Merge branch 'main' into unit
NiklasGustafsson Feb 22, 2024
47624e8
Merge branch 'torchvision' of https://github.com/NiklasGustafsson/Tor…
Feb 28, 2024
26c4360
Merge branch 'unit' of https://github.com/NiklasGustafsson/TorchSharp…
Feb 28, 2024
6fafdbd
Added no grad in loadstatedict
shaltielshmid Feb 27, 2024
0742fb6
typo
shaltielshmid Feb 27, 2024
72b1261
Added release notes
shaltielshmid Feb 28, 2024
c5bd494
Updated release notes for 0.102.0
shaltielshmid Feb 28, 2024
e2ca473
Fixed average pool 1d + npstr/cstr with one dimension
shaltielshmid Mar 2, 2024
428a66a
Added release notes
shaltielshmid Mar 2, 2024
8c37c5c
Renamed kernel_size
shaltielshmid Mar 4, 2024
c9ec3b2
Fixed issue with read and added test + release notes
shaltielshmid Feb 29, 2024
d5d1fd0
Added check for end of stream mid tensor
shaltielshmid Feb 29, 2024
4fb25b6
Added check for net 6
shaltielshmid Mar 4, 2024
9191f9b
Update TestTorchTensorBugs.cs
NiklasGustafsson Mar 4, 2024
54ee83b
Address issue with ordering of initializations in the torch cctor.
NiklasGustafsson Mar 5, 2024
06675ec
Update BranchInfo.props
NiklasGustafsson Mar 5, 2024
88bd908
Update version number
NiklasGustafsson Mar 5, 2024
1d6a76f
Merge branch 'main' into unit
NiklasGustafsson Mar 5, 2024
89f53c2
Finished merging a file that was missed.
NiklasGustafsson Mar 5, 2024
c6d80f9
Merge branch 'main' into unit
NiklasGustafsson Mar 5, 2024
6f23a5d
Remove duplicate test
NiklasGustafsson Mar 5, 2024
c5470fe
Added properties to a number of builtin modules.
NiklasGustafsson Mar 5, 2024
6c0f2a2
Introduced 'ParamLessModule' as the base class on more modules.
NiklasGustafsson Mar 5, 2024
4cb57e1
Added properties to a number of modules.
NiklasGustafsson Mar 5, 2024
34405c6
Removed unused Bilinear native APIs.
NiklasGustafsson Mar 5, 2024
f246c11
Added Component name attribute to some classes.
NiklasGustafsson Mar 5, 2024
1192d8e
Merge branch 'main' into unit
Mar 11, 2024
cff452a
Reviewed all modified modules and continued, made adjustments and con…
shaltielshmid Mar 12, 2024
5bcab46
Revert "Reviewed all modified modules and continued, made adjustments…
NiklasGustafsson Mar 12, 2024
66cab20
Reopening PR after testing on Mac (#18)
shaltielshmid Mar 13, 2024
e21aacf
Moved all activation modules to managed code.
NiklasGustafsson Mar 13, 2024
640b7bf
Added check of 'disposing' in one place.
NiklasGustafsson Mar 13, 2024
6c93429
Address PR comments.
NiklasGustafsson Mar 14, 2024
0ef818b
More PR adjustments
NiklasGustafsson Mar 14, 2024
d4c0482
Moved GroupNorm to C#
NiklasGustafsson Mar 14, 2024
4ba0a92
Implement BatchNorm and InstanceNorm modules in terms of the function…
NiklasGustafsson Mar 14, 2024
39fce55
Merge branch 'main' into unit
NiklasGustafsson Mar 15, 2024
ff0ffbc
Merge branch 'main' into unit
NiklasGustafsson Mar 15, 2024
9f61b15
Merge branch 'main' into unit
NiklasGustafsson Mar 15, 2024
ed3ecd3
Address PR comments and a unit test failure.
NiklasGustafsson Mar 19, 2024
b24ef9a
Fixed unit test error and PRELU implementation.
NiklasGustafsson Mar 19, 2024
25e128c
Added some missing test files to the CUDA test project.
NiklasGustafsson Mar 21, 2024
254470e
Overrides on ParamLessModule
NiklasGustafsson Mar 22, 2024
09598b9
Merge branch 'main' into unit
NiklasGustafsson Mar 22, 2024
72356a4
Manual merge
NiklasGustafsson Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Examples/AlexNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ public AlexNet(string name, int numClasses, torch.Device device = null) : base(n
features = Sequential(
("c1", Conv2d(3, 64, kernelSize: 3, stride: 2, padding: 1)),
("r1", ReLU(inplace: true)),
("mp1", MaxPool2d(kernelSize: new long[] { 2, 2 })),
("mp1", MaxPool2d(kernel_size: new long[] { 2, 2 })),
("c2", Conv2d(64, 192, kernelSize: 3, padding: 1)),
("r2", ReLU(inplace: true)),
("mp2", MaxPool2d(kernelSize: new long[] { 2, 2 })),
("mp2", MaxPool2d(kernel_size: new long[] { 2, 2 })),
("c3", Conv2d(192, 384, kernelSize: 3, padding: 1)),
("r3", ReLU(inplace: true)),
("c4", Conv2d(384, 256, kernelSize: 3, padding: 1)),
("r4", ReLU(inplace: true)),
("c5", Conv2d(256, 256, kernelSize: 3, padding: 1)),
("r5", ReLU(inplace: true)),
("mp3", MaxPool2d(kernelSize: new long[] { 2, 2 })));
("mp3", MaxPool2d(kernel_size: new long[] { 2, 2 })));

avgPool = AdaptiveAvgPool2d(new long[] { 2, 2 });

Expand Down
2 changes: 1 addition & 1 deletion src/Examples/MNIST.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ internal class Model : Module<Tensor, Tensor>

// These don't have any parameters, so the only reason to instantiate
// them is performance, since they will be used over and over.
private Module<Tensor, Tensor> pool1 = MaxPool2d(kernelSize: new long[] { 2, 2 });
private Module<Tensor, Tensor> pool1 = MaxPool2d(kernel_size: new long[] { 2, 2 });

private Module<Tensor, Tensor> relu1 = ReLU();
private Module<Tensor, Tensor> relu2 = ReLU();
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/VGG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public VGG(string name, int numClasses, Device device = null) : base(name)
for (var i = 0; i < channels.Length; i++) {

if (channels[i] == 0) {
modules.Add(($"MaxPool2d-{i}a", MaxPool2d(kernelSize: 2, stride: 2)));
modules.Add(($"MaxPool2d-{i}a", MaxPool2d(kernel_size: 2, stride: 2)));
} else {
modules.Add(($"conv2d-{i}a", Conv2d(in_channels, channels[i], kernelSize: 3, padding: 1)));
modules.Add(($"bnrm2d-{i}a", BatchNorm2d(channels[i])));
Expand Down
6 changes: 3 additions & 3 deletions src/FSharp.Examples/AlexNet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ type Model(name,device:torch.Device) as this =

let features = Sequential(("c1", Conv2d(3L, 64L, kernelSize=3L, stride=2L, padding=1L) :> Module<torch.Tensor,torch.Tensor>),
("r1", ReLU(inplace=true) :> Module<torch.Tensor,torch.Tensor>),
("mp1", MaxPool2d(kernelSize=[|2L; 2L|]) :> Module<torch.Tensor,torch.Tensor>),
("mp1", MaxPool2d(kernel_size=[|2L; 2L|]) :> Module<torch.Tensor,torch.Tensor>),
("c2", Conv2d(64L, 192L, kernelSize=3L, padding=1L) :> Module<torch.Tensor,torch.Tensor>),
("r2", ReLU(inplace=true) :> Module<torch.Tensor,torch.Tensor>),
("mp2", MaxPool2d(kernelSize=[|2L; 2L|]) :> Module<torch.Tensor,torch.Tensor>),
("mp2", MaxPool2d(kernel_size=[|2L; 2L|]) :> Module<torch.Tensor,torch.Tensor>),
("c3", Conv2d(192L, 384L, kernelSize=3L, padding=1L) :> Module<torch.Tensor,torch.Tensor>),
("r3", ReLU(inplace=true) :> Module<torch.Tensor,torch.Tensor>),
("c4", Conv2d(384L, 256L, kernelSize=3L, padding=1L) :> Module<torch.Tensor,torch.Tensor>),
("r4", ReLU(inplace=true) :> Module<torch.Tensor,torch.Tensor>),
("c5", Conv2d(256L, 256L, kernelSize=3L, padding=1L) :> Module<torch.Tensor,torch.Tensor>),
("r5", ReLU(inplace=true) :> Module<torch.Tensor,torch.Tensor>),
("mp3", MaxPool2d(kernelSize=[|2L; 2L|]) :> Module<torch.Tensor,torch.Tensor>),
("mp3", MaxPool2d(kernel_size=[|2L; 2L|]) :> Module<torch.Tensor,torch.Tensor>),
("avg", AdaptiveAvgPool2d([|2L; 2L|]) :> Module<torch.Tensor,torch.Tensor>))

let classifier = Sequential(("d1", Dropout() :> Module<torch.Tensor,torch.Tensor>),
Expand Down
2 changes: 1 addition & 1 deletion src/FSharp.Examples/MNIST.fs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type Model(name,device:torch.Device) as this =
let fc1 = Linear(9216L, 128L)
let fc2 = Linear(128L, 10L)

let pool1 = MaxPool2d(kernelSize=[|2L; 2L|])
let pool1 = MaxPool2d(kernel_size=[|2L; 2L|])

let relu = ReLU()

Expand Down
327 changes: 0 additions & 327 deletions src/Native/LibTorchSharp/THSActivation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,330 +2,3 @@
#include "THSNN.h"

#include <torch/nn/init.h>

NNModule THSNN_CELU_ctor(const double alpha, const bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::CELUOptions().alpha(alpha).inplace(inplace);
res = create_module<torch::nn::CELUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_CELU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::CELU>()->forward(*tensor));
}

NNModule THSNN_ELU_ctor(const double alpha, const bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::ELUOptions().alpha(alpha).inplace(inplace);
res = create_module<torch::nn::ELUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_ELU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::ELU>()->forward(*tensor));
}

NNModule THSNN_GELU_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::GELUImpl>(outAsAnyModule);
);
}

Tensor THSNN_GELU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::GELU>()->forward(*tensor));
}

NNModule THSNN_GLU_ctor(const int64_t dim, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::GLUOptions().dim(dim);
res = create_module<torch::nn::GLUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_GLU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::GLU>()->forward(*tensor));
}

NNModule THSNN_Hardshrink_ctor(const double lambda, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::HardshrinkOptions(lambda);
res = create_module<torch::nn::HardshrinkImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_Hardshrink_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Hardshrink>()->forward(*tensor));
}

NNModule THSNN_Hardtanh_ctor(const double min_val, const double max_val, const bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::HardtanhOptions()
.min_val(min_val)
.max_val(max_val)
.inplace(inplace);
res = create_module<torch::nn::HardtanhImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_Hardtanh_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Hardtanh>()->forward(*tensor));
}


NNModule THSNN_LeakyReLU_ctor(const double negative_sloope, const bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::LeakyReLUOptions().negative_slope(negative_sloope).inplace(inplace);
res = create_module<torch::nn::LeakyReLUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_LeakyReLU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::LeakyReLU>()->forward(*tensor));
}

NNModule THSNN_LogSoftmax_ctor(int64_t dim, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::LogSoftmaxOptions(dim);
res = create_module<torch::nn::LogSoftmaxImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_LogSoftmax_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::LogSoftmax>()->forward(*tensor));
}

NNModule THSNN_Mish_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::MishImpl>(outAsAnyModule);
);
}

Tensor THSNN_Mish_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Mish>()->forward(*tensor));
}

NNModule THSNN_PReLU_ctor(const int64_t nparams, const double init, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::PReLUOptions().num_parameters(nparams).init(init);
res = create_module<torch::nn::PReLUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_PReLU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::PReLU>()->forward(*tensor));
}

Tensor THSNN_PReLU_weight(const NNModule module)
{
return get_weight<torch::nn::PReLU>(module);
}

void THSNN_PReLU_set_weight(const NNModule module, const Tensor weight)
{
set_weight<torch::nn::PReLU>(module, weight);
}

NNModule THSNN_ReLU_ctor(bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::ReLUOptions(inplace);
res = create_module<torch::nn::ReLUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_ReLU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::ReLU>()->forward(*tensor));
}

NNModule THSNN_RReLU_ctor(const double lower, const double upper, const bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::RReLUOptions().lower(lower).upper(upper).inplace(inplace);
res = create_module<torch::nn::RReLUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_RReLU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::RReLU>()->forward(*tensor));
}

NNModule THSNN_ReLU6_ctor(bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::ReLU6Options(inplace);
res = create_module<torch::nn::ReLU6Impl>(opts, outAsAnyModule);
);
}

Tensor THSNN_ReLU6_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::ReLU6>()->forward(*tensor));
}

NNModule THSNN_SELU_ctor(bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::SELUOptions(inplace);
res = create_module<torch::nn::SELUImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_SELU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::SELU>()->forward(*tensor));
}

NNModule THSNN_Sigmoid_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::SigmoidImpl>(outAsAnyModule);
);
}

Tensor THSNN_Sigmoid_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Sigmoid>()->forward(*tensor));
}

NNModule THSNN_SiLU_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::SiLUImpl>(outAsAnyModule);
);
}

Tensor THSNN_SiLU_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::SiLU>()->forward(*tensor));
}

NNModule THSNN_Softmax2d_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::Softmax2dImpl>(outAsAnyModule);
);
}

Tensor THSNN_Softmax2d_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Softmax2d>()->forward(*tensor));
}

NNModule THSNN_Softmax_ctor(const int64_t dim, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::SoftmaxOptions(dim);
res = create_module<torch::nn::SoftmaxImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_Softmax_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Softmax>()->forward(*tensor));
}

NNModule THSNN_Softmin_ctor(const int64_t dim, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::SoftminOptions(dim);
res = create_module<torch::nn::SoftminImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_Softmin_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Softmin>()->forward(*tensor));
}

NNModule THSNN_Softplus_ctor(const double beta, const double threshold, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::SoftplusOptions().beta(beta).threshold(threshold);
res = create_module<torch::nn::SoftplusImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_Softplus_forward(const NNModule module, const Tensor tensor) {
CATCH_TENSOR((*module)->as<torch::nn::Softplus>()->forward(*tensor));
}

NNModule THSNN_Softshrink_ctor(const double lambda, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::SoftshrinkOptions().lambda(lambda);
res = create_module<torch::nn::SoftshrinkImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_Softshrink_forward(const NNModule module, const Tensor tensor) {
CATCH_TENSOR((*module)->as<torch::nn::Softshrink>()->forward(*tensor));
}

NNModule THSNN_Softsign_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::SoftsignImpl>(outAsAnyModule);
);
}

Tensor THSNN_Softsign_forward(const NNModule module, const Tensor tensor) {
CATCH_TENSOR((*module)->as<torch::nn::Softsign>()->forward(*tensor));
}

NNModule THSNN_Tanh_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::TanhImpl>(outAsAnyModule);
);
}

Tensor THSNN_Tanh_forward(const NNModule module, const Tensor tensor)
{
CATCH_TENSOR((*module)->as<torch::nn::Tanh>()->forward(*tensor));
}

NNModule THSNN_Tanhshrink_ctor(NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
res = create_module<torch::nn::TanhshrinkImpl>(outAsAnyModule);
);
}

Tensor THSNN_Tanhshrink_forward(const NNModule module, const Tensor tensor) {
CATCH_TENSOR((*module)->as<torch::nn::Tanhshrink>()->forward(*tensor));
}

NNModule THSNN_Threshold_ctor(const double threshold, const double value, const bool inplace, NNAnyModule* outAsAnyModule)
{
CATCH_RETURN_NNModule(
auto opts = torch::nn::ThresholdOptions(threshold, value).inplace(inplace);
res = create_module<torch::nn::ThresholdImpl>(opts, outAsAnyModule);
);
}

Tensor THSNN_Threshold_forward(const NNModule module, const Tensor tensor) {
CATCH_TENSOR((*module)->as<torch::nn::Threshold>()->forward(*tensor));
}

Loading