Will Feng
d04973beda
Use c10::variant-based enums for EmbeddingBag mode ( #28330 )
...
Summary:
This PR is BC-breaking in the following way:
Previous, we require the use of `std::string` to specify the mode for `EmbeddingBag`. After this PR, we use variant-based enums such as `torch::kSum` / `torch::kMean` / `torch::kMax` to specify the mode for `EmbeddingBag`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28330
Differential Revision: D18127116
Pulled By: yf225
fbshipit-source-id: 15cd86c764777f4d399587be92cda15b6ce8524b
2019-10-24 17:47:42 -07:00
Will Feng
92b39434a2
C++ nn::ConstantPad{1,2,3}d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28541
Test Plan: Imported from OSS
Differential Revision: D18115607
Pulled By: yf225
fbshipit-source-id: 736df791ddc3cd30ad9af89eacfb4a0c6b53f2cd
2019-10-24 15:10:27 -07:00
Will Feng
7f9941c4ea
C++ nn::ZeroPad2d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28540
Test Plan: Imported from OSS
Differential Revision: D18115610
Pulled By: yf225
fbshipit-source-id: ced7c0917f4712838e753cd2e9fc4fa79fd5d310
2019-10-24 14:23:57 -07:00
Will Feng
303527d733
C++ nn::ReplicationPad{1,2,3}d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28539
Test Plan: Imported from OSS
Differential Revision: D18115609
Pulled By: yf225
fbshipit-source-id: 15f4ab6a114279bb06bf62f1265b62aa12f8700f
2019-10-24 12:49:41 -07:00
Will Feng
78375c02b8
C++ nn::ReflectionPad1d and nn::ReflectionPad2d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28538
Test Plan: Imported from OSS
Differential Revision: D18115608
Pulled By: yf225
fbshipit-source-id: 3a48d8c11721f013076db2965f5f75b71662c78e
2019-10-24 12:02:51 -07:00
Pavel Belevich
dd277e9086
C++ API parity: Linear
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27382
Test Plan: Imported from OSS
Differential Revision: D17766735
Pulled By: pbelevich
fbshipit-source-id: c7a66daeb17550eb9a5d26944427723d4ebdc6c8
2019-10-24 07:11:51 -07:00
Anjali Chourdia
7b59174882
torch::nn::LayerNorm
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/28032
Differential Revision: D18047371
Pulled By: anjali411
fbshipit-source-id: fb61aea52d6622a67ec1d84950e17e85686461ae
2019-10-22 12:50:22 -07:00
nuka137
9ea42f8d7c
C++ API: torch::nn::LPPool1d ( #27800 )
...
Summary:
Add torch::nn::LPPool1d module and functional support for the C++ API.
Related Issue: https://github.com/pytorch/pytorch/issues/25883
Reviewer: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27800
Differential Revision: D18045040
Pulled By: yf225
fbshipit-source-id: e61fefe9efec3423f7a93dd1e946f3e380122927
2019-10-21 15:33:51 -07:00
Carlos Miranda
a1e14a6626
PixelShuffle module and functional ( #28140 )
...
Summary:
Added `PixelShuffle` module and functional https://github.com/pytorch/pytorch/issues/25883
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28140
Differential Revision: D18008474
Pulled By: yf225
fbshipit-source-id: f482495bb56998701c79a61ef065a121bf5a5154
2019-10-18 15:54:14 -07:00
Shahriar
91a260cef9
Adding MSELoss, KLDivLoss and BCELoss to C++ front-end ( #27156 )
...
Summary:
This PR adds ```MSELoss```, ```KLDivLoss``` and ```BCELoss```. The tests for ```BCELoss``` fail with the following error:
```
unknown file: Failure
C++ exception with description "autograd_meta() INTERNAL ASSERT FAILED at /home/shahriar/Contrib/pytorch/c10/core/TensorImpl.h:533, please report a bug to PyTorch. set_requires_grad is not implemented for Tensor (set_requires_grad at /home/shahriar/Contrib/pytorch/c10/core/TensorImpl.h:533)
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27156
Differential Revision: D17960323
Pulled By: yf225
fbshipit-source-id: 84b8431064f2f573679c03a8d7994e3e2f81a4d1
2019-10-17 22:07:01 -07:00
Carlos Miranda
7d277b0670
Multi Label Margin loss ( #27659 )
...
Summary:
In accordance with https://github.com/pytorch/pytorch/issues/25883 , I added the `MultiLabelMarginLoss` module and `multilabel_margin_loss` functional.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27659
Differential Revision: D17931905
Pulled By: yf225
fbshipit-source-id: 3642f75c79843dda55ac38de9f6f970f3e237847
2019-10-16 15:44:38 -07:00
Carlos Miranda
9540f6c3fe
Soft Margin loss ( #27660 )
...
Summary:
In accordance with https://github.com/pytorch/pytorch/issues/25883 , I added the `SoftMarginLoss` module and `soft_margin_loss` functional.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27660
Differential Revision: D17958325
Pulled By: yf225
fbshipit-source-id: c14422765e6e1fdabf6c9687080e6d5ff490d300
2019-10-16 12:04:08 -07:00
Moksh Jain
f38beff800
Add nn.Bilinear to C++ Frontend ( #26082 )
...
Summary:
Adds support for the Bilinear layer to the C++ frontend
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26082
Differential Revision: D17954148
Pulled By: yf225
fbshipit-source-id: 5e746bdea29b00e25969cd7a22044b8059b53687
2019-10-16 09:54:01 -07:00
Divyansh Singhvi
3397d41b8a
Wrapping namespace Reduction in namespace at ( #26606 ) ( #27422 )
...
Summary:
1) Wrapped namespace `Reduction` in namespace `at`
2) Prefixed `at::` wherever `Reduction::` is used
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27422
Differential Revision: D17913759
Pulled By: yf225
fbshipit-source-id: 8f00ca01cad2e7f673d316b128abf59c026e216c
2019-10-15 11:05:40 -07:00
Will Feng
11172c19be
codemod at::ArrayRef and torch::IntArrayRef to std::vector in C++ API tests ( #27884 )
...
Summary:
`at::ArrayRef` / `torch::IntArrayRef` should be discouraged in user code, because users might not be aware of the fact that it doesn't own the underlying data, which already leads to memory access bugs when they try to write the following:
```cpp
auto expected_sizes = torch::IntArrayRef({2, 16, 6}); // The memory that represents `{2, 16, 6}` is released after this line
ASSERT_EQ(output.sizes(), expected_sizes); // `expected_sizes` is pointing to invalid memory region
```
This PR changes all usage of `at::ArrayRef` and `torch::IntArrayRef` to the corresponding `std::vector` version, so that users won't pick up the habit of using `ArrayRef` by looking at the test code.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27884
Differential Revision: D17921646
Pulled By: yf225
fbshipit-source-id: 461e79fc22b598aac230d36cc028085ce6cbe937
2019-10-14 18:00:30 -07:00
Carlos Miranda
2cae3928b0
Multi-Label Soft Margin loss ( #27669 )
...
Summary:
In accordance with https://github.com/pytorch/pytorch/issues/25883 , I added the `MultiLabelSoftMarginLoss` module and `multilabel_soft_margin_loss` functional.
It looks like there isn't a C++ ATen implementation of `multilabel_soft_margin_loss`, so I translated the python version, which does not rely on a C/C++ backend either.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27669
Differential Revision: D17907608
Pulled By: yf225
fbshipit-source-id: ccb02951e009973c2adbe604593ce929f10c39eb
2019-10-14 13:29:45 -07:00
jon-tow
0003771423
C++ API parity: Unfold ( #27809 )
...
Summary:
Adds `unfold` functional and module support for the C++ API.
Issue: https://github.com/pytorch/pytorch/issues/25883
Reviewer: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27809
Differential Revision: D17901792
Pulled By: yf225
fbshipit-source-id: ff58a1866bf240f37ebc589463c60593b8931f51
2019-10-14 13:21:59 -07:00
nuka137
07d4374239
C++ API: torch::nn::Softmax2d ( #27509 )
...
Summary:
Add torch::nn::Softmax2d module support for the C++ API.
Softmax2d only supports module in Python API, so this PR adds only module support as well.
This PR is WIP because it uses the function in https://github.com/pytorch/pytorch/issues/27446 .
After https://github.com/pytorch/pytorch/issues/27446 is merged, I will remove WIP.
Related Issue: https://github.com/pytorch/pytorch/issues/25883
Reviewer: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27509
Differential Revision: D17899715
Pulled By: yf225
fbshipit-source-id: bd891bc995f5a92bf4f5405f8bf07d1bd5de2479
2019-10-13 11:00:56 -07:00
PyExtreme
52528c041a
- TripletMarginLoss ( #27713 )
...
Summary:
Hi yf225 , I had to create a new branch to tackle merge conflict since I am using cloud due to some limitations on my PC. Therefore, I don't have enough command there.
Also, I have incorporated the changes you have put before here
https://github.com/pytorch/pytorch/pull/27613
Also, it would be great if you could recommend me some resources to work smmothly on GCP..:-D
Thank you
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27713
Differential Revision: D17899695
Pulled By: yf225
fbshipit-source-id: eb6643223148774a5cbbd093bdcc5623872e5bba
2019-10-13 10:57:37 -07:00
Pavel Belevich
446a79b959
C++ API parity: Threshold
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27538
Test Plan: Imported from OSS
Differential Revision: D17835415
Pulled By: pbelevich
fbshipit-source-id: 2a887704655be79ee458081c46a7eea31eca51dc
2019-10-13 09:38:31 -07:00
Pavel Belevich
cbdd55c669
C++ API parity: Tanhshrink
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27537
Test Plan: Imported from OSS
Differential Revision: D17835409
Pulled By: pbelevich
fbshipit-source-id: ad4120cfe01ea2508bf3ce1054022a2da649ac74
2019-10-13 08:12:13 -07:00
Pavel Belevich
2750ea25b2
C++ API parity: Tanh
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27536
Test Plan: Imported from OSS
Differential Revision: D17835411
Pulled By: pbelevich
fbshipit-source-id: c8984aec2f4bae48ff901fafc8c53a4122192ac5
2019-10-13 06:34:18 -07:00
Pavel Belevich
96aafc3cdc
C++ API parity: Softsign
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27535
Test Plan: Imported from OSS
Differential Revision: D17835408
Pulled By: pbelevich
fbshipit-source-id: 8548deab91f6fe0f7285fdd919c25129ed042181
2019-10-12 08:30:10 -07:00
Pavel Belevich
fcb6dd079e
C++ API parity: Softshrink
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27534
Test Plan: Imported from OSS
Differential Revision: D17835404
Pulled By: pbelevich
fbshipit-source-id: 7b9f3d3ea793f82840496912f248b0c48bb7463e
2019-10-12 06:36:20 -07:00
nuka137
abaa44122d
C++ API: torch::nn::Softmin ( #27459 )
...
Summary:
Add torch::nn::Softmin module and functional support for the C++ API.
Related Issue: https://github.com/pytorch/pytorch/issues/25883
Reviewer: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27459
Differential Revision: D17892852
Pulled By: yf225
fbshipit-source-id: db15b06e8ad33947e7d65995df700f5e90c3b6a8
2019-10-11 23:03:55 -07:00
Pavel Belevich
c79d3a4a98
C++ API parity: Softplus
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27489
Test Plan: Imported from OSS
Differential Revision: D17835410
Pulled By: pbelevich
fbshipit-source-id: 51a8c4ab2ff4b860c96eda1ed8f073017b8cf9ae
2019-10-11 09:00:32 -07:00
Pavel Belevich
9d448099fd
C++ API parity: Sigmoid
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27488
Test Plan: Imported from OSS
Differential Revision: D17835405
Pulled By: pbelevich
fbshipit-source-id: 78e13047a2a1f2776c59e778db7ba120716e93d3
2019-10-11 07:45:31 -07:00
Pavel Belevich
795c913636
C++ API parity: CELU
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27487
Test Plan: Imported from OSS
Differential Revision: D17835406
Pulled By: pbelevich
fbshipit-source-id: a8282ae65d8996efcc8b8d846cfa637c3f89eda6
2019-10-11 06:23:57 -07:00
Pavel Belevich
6294a9a877
C++ API parity: RReLU
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27437
Test Plan: Imported from OSS
Differential Revision: D17835413
Pulled By: pbelevich
fbshipit-source-id: 5d943fdac4fd2633e7f7ca13db1a7fed5636ca50
2019-10-10 19:14:48 -07:00
Pavel Belevich
352092ca95
C++ API parity: ReLU6
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27436
Test Plan: Imported from OSS
Differential Revision: D17835414
Pulled By: pbelevich
fbshipit-source-id: 77e743d2f6b71fb3ba5643f9d676f2bb8f236cfa
2019-10-10 17:12:17 -07:00
nuka137
6711969dd8
C++ API: torch::nn::LogSoftmax ( #27462 )
...
Summary:
Add torch::nn::LogSoftmax module and functional support for the C++ API.
Related Issue: https://github.com/pytorch/pytorch/issues/25883
Reviewer: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27462
Differential Revision: D17867121
Pulled By: yf225
fbshipit-source-id: dae8ac981c1c6ccdef013cd2d886ad4a043f6243
2019-10-10 16:18:15 -07:00
Pavel Belevich
8515650c2b
C++ API parity: ReLU
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27435
Test Plan: Imported from OSS
Differential Revision: D17835407
Pulled By: pbelevich
fbshipit-source-id: b8ee86c7a76674bc88d8e995424dad22d3caab59
2019-10-10 13:34:38 -07:00
Pavel Belevich
1fec1441a1
C++ API parity: PReLU
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27429
Test Plan: Imported from OSS
Differential Revision: D17835412
Pulled By: pbelevich
fbshipit-source-id: e678d5920dad1293bb0ba3de28e2da3087d19bde
2019-10-09 16:31:54 -07:00
Carlos Miranda
3246fddfd6
Implement C++ API torch::nn::MultiMarginLoss. ( #27424 )
...
Summary:
Hi yf225 , here is the C++ frontend API MultiMarginLoss implementation and tests https://github.com/pytorch/pytorch/issues/27198 . Could you review it and tell me if it is okay?
I am not entirely sure I used `c10::optional` correctly, but `options.weight()` resulted in a compilation error, so I went with `options.weight().value()` instead of `value_or()` to follow the logic in `torch.nn._WeightedLoss.register_buffer` (where one can pass a `None` value).
Oh, and are the tests supposed to be skipped or did I do something wrong? I ran `pytest test/test_cpp_api_parity.py -k Loss -v` , and the `L1Loss` test passed but the others were skipped...
Thank you for the review in any case!
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27424
Differential Revision: D17839963
Pulled By: yf225
fbshipit-source-id: f4b6012590cf22d56d42751c214df80cce717cb8
2019-10-09 14:44:41 -07:00
jon-tow
0fed4756d0
C++ API parity: SELU ( #27434 )
...
Summary:
Adds `SELU` functional and module support for the C++ API.
Issue: https://github.com/pytorch/pytorch/issues/25883
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27434
Differential Revision: D17782762
Pulled By: yf225
fbshipit-source-id: 96c7ce84b9baf9e219a63e631929b8997ba6f3f0
2019-10-09 14:39:28 -07:00
nuka137
28a1806cbc
C++ API: torch::nn::Softmax ( #27446 )
...
Summary:
Add torch::nn::Softmax module support for the C++ API
Related Issue: https://github.com/pytorch/pytorch/issues/25883
Reviewer: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27446
Differential Revision: D17839546
Pulled By: yf225
fbshipit-source-id: 7c7fb55111b261614de7c3a75fa1019fbde93c67
2019-10-09 14:19:47 -07:00
Anjali Chourdia
a37be201c1
Implement torch.nn.Embedding / EmbeddingBag in PyTorch C++ API ( #26358 )
...
Summary:
added more variables to EmbeddingOptions and updated EmbeddingImpl reset, forward functions. Also added EmbeddingBag.
-----
This PR is BC-breaking in the following way:
Previously, `EmbeddingOptions` supports `count` and `dimension` as options arguments. After this PR, they are renamed to `num_embeddings` and `embedding_dim` respectively.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/26358
Differential Revision: D17714337
Pulled By: yf225
fbshipit-source-id: f9f969c68e4bece106b92f8e2e02ac39c8455fb7
2019-10-08 22:13:39 -07:00
Jonathan Tow
3b5d40c339
Add C++ torch::nn::CosineEmbeddingLoss ( #27345 )
...
Summary:
Adds `torch::nn::CosineEmbeddingLoss` module and functional support for the C++ API.
Issue: https://github.com/pytorch/pytorch/issues/25883
Reviewer: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27345
Differential Revision: D17801402
Pulled By: yf225
fbshipit-source-id: 0eabe80d7d36397e6667b331c3fa2f56d7a15962
2019-10-08 10:52:05 -07:00
Pavel Belevich
2cc1e69cc9
C++ API parity: LogSigmoid
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27060
Test Plan: Imported from OSS
Differential Revision: D17682404
Pulled By: pbelevich
fbshipit-source-id: d60d64cd4caf1f56a2e05c516f91321d46ec9624
2019-10-05 06:18:25 -07:00
Pavel Belevich
8b61a220c0
C++ API parity: LeakyReLU
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27059
Test Plan: Imported from OSS
Differential Revision: D17682407
Pulled By: pbelevich
fbshipit-source-id: 2a4f42e9438799ba8de7282ac7a6fd3ff97ee048
2019-10-04 14:18:03 -07:00
Pavel Belevich
192ca9730f
C++ API parity: Hardtanh
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27038
Test Plan: Imported from OSS
Differential Revision: D17682405
Pulled By: pbelevich
fbshipit-source-id: f65e76696e0041c3518f56da94f2e3b800305234
2019-10-04 12:53:33 -07:00
Pavel Belevich
515e3b85da
C++ API parity: Hardshrink
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27035
Test Plan: Imported from OSS
Differential Revision: D17682403
Pulled By: pbelevich
fbshipit-source-id: 186377fe577abfdd53acc95751a7ed845b51af95
2019-10-02 08:30:20 -07:00
Pavel Belevich
c864454a8f
C++ API parity: ELU
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27028
Test Plan: Imported from OSS
Differential Revision: D17682406
Pulled By: pbelevich
fbshipit-source-id: 9c313237cb93b9870c6fcf8d01b3dbe4af4c6f2a
2019-10-02 07:12:08 -07:00
Pavel Belevich
5005f7bce7
C++ API parity: MaxUnpool3d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/27027
Test Plan: Imported from OSS
Differential Revision: D17682402
Pulled By: pbelevich
fbshipit-source-id: 2008ce405176c174cdba88b4f25cd77a82bb13ea
2019-10-02 05:40:42 -07:00
Pavel Belevich
5cac738713
C++ API parity: MaxUnpool2d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26915
Test Plan: Imported from OSS
Differential Revision: D17627826
Pulled By: pbelevich
fbshipit-source-id: 04a5a7e7d19b1610cafaaa0bd329d4d228ab4be5
2019-10-01 19:29:15 -07:00
Pavel Belevich
d125a83f98
C++ API parity: MaxUnpool1d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26896
Test Plan: Imported from OSS
Differential Revision: D17627825
Pulled By: pbelevich
fbshipit-source-id: 369d0080412467d0259eb5e692a0778c71b12343
2019-10-01 14:53:40 -07:00
jon-tow
209dc4c4ba
Add C++ torch::nn::HingeEmbeddingLoss ( #27101 )
...
Summary:
Adds `torch::nn::HingeEmbeddingLoss` module support for the C++ API.
**Issue**: https://github.com/pytorch/pytorch/issues/25883
**Reviewer**: yf225
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27101
Differential Revision: D17680489
Pulled By: yf225
fbshipit-source-id: 1f8f41775a9e1272a98232c8f899418b2b907eca
2019-09-30 19:29:24 -07:00
Pavel Belevich
1a3997e0b8
C++ API parity: AdaptiveAvgPool3d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26819
Test Plan: Imported from OSS
Differential Revision: D17627829
Pulled By: pbelevich
fbshipit-source-id: be4d803c7d4ba2c59e54d154eeebc63794465191
2019-09-28 22:32:21 -07:00
Pavel Belevich
a31fd5ea68
C++ API parity: AdaptiveAvgPool2d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26818
Test Plan: Imported from OSS
Differential Revision: D17627822
Pulled By: pbelevich
fbshipit-source-id: 0e1dea1c3ff2650dbc7902ce704ac6b47588d0bb
2019-09-28 10:45:03 -07:00
Pavel Belevich
7d58060f49
C++ API parity: AdaptiveAvgPool1d
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/26808
Test Plan: Imported from OSS
Differential Revision: D17627827
Pulled By: pbelevich
fbshipit-source-id: 13ad1d0414e7b62f4fc2f6573332bb2c07b16b53
2019-09-28 10:23:31 -07:00