xiaobing.zhang
9ba6a768de
Add op bitwise_or ( #31559 )
...
Summary:
ezyang , this PR add bitwise_or operator as https://github.com/pytorch/pytorch/pull/31104 .
Benchmark script :
```
import timeit
import torch
torch.manual_seed(1)
for n, t in [(10, 100000),(1000, 10000)]:
print('__or__ (a.numel() == {}) for {} times'.format(n, t))
for device in ('cpu', 'cuda'):
for dtype in ('torch.int8', 'torch.uint8', 'torch.int16', 'torch.int32', 'torch.int64'):
print(f'device: {device}, dtype: {dtype}, {t} times', end='\t\t')
print(timeit.timeit(f'a | b\nif "{device}" == "cuda": torch.cuda.synchronize()', setup=f'import torch; a = torch.randint(0, 10, ({n},), dtype = {dtype}, device="{device}"); b = torch.randint(0, 10, ({n},), dtype = {dtype}, device="{device}")', number=t))
for n, t in [(10, 100000),(1000, 10000)]:
print('__ior__ (a.numel() == {}) for {} times'.format(n, t))
for device in ('cpu', 'cuda'):
for dtype in ('torch.int8', 'torch.uint8', 'torch.int16', 'torch.int32', 'torch.int64'):
print(f'device: {device}, dtype: {dtype}, {t} times', end='\t\t')
print(timeit.timeit(f'a | b\nif "{device}" == "cuda": torch.cuda.synchronize()', setup=f'import torch; a = torch.randint(0, 10, ({n},), dtype = {dtype}, device="{device}"); b = torch.tensor(5, dtype = {dtype}, device="{device}")', number=t))
```
Device: **Tesla P100, skx-8180**
Cuda verison: **9.0.176**
Before:
```
__or__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.17616272252053022
device: cpu, dtype: torch.uint8, 100000 times 0.17148233391344547
device: cpu, dtype: torch.int16, 100000 times 0.17616403382271528
device: cpu, dtype: torch.int32, 100000 times 0.17717823758721352
device: cpu, dtype: torch.int64, 100000 times 0.1801931718364358
device: cuda, dtype: torch.int8, 100000 times 1.270583058707416
device: cuda, dtype: torch.uint8, 100000 times 1.2636413089931011
device: cuda, dtype: torch.int16, 100000 times 1.2839747751131654
device: cuda, dtype: torch.int32, 100000 times 1.2548385225236416
device: cuda, dtype: torch.int64, 100000 times 1.2650810535997152
__or__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.031136621721088886
device: cpu, dtype: torch.uint8, 10000 times 0.030786747112870216
device: cpu, dtype: torch.int16, 10000 times 0.02391665056347847
device: cpu, dtype: torch.int32, 10000 times 0.024147341027855873
device: cpu, dtype: torch.int64, 10000 times 0.024414129555225372
device: cuda, dtype: torch.int8, 10000 times 0.12741921469569206
device: cuda, dtype: torch.uint8, 10000 times 0.1249831635504961
device: cuda, dtype: torch.int16, 10000 times 0.1283819805830717
device: cuda, dtype: torch.int32, 10000 times 0.12591975275427103
device: cuda, dtype: torch.int64, 10000 times 0.12655890546739101
__ior__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.3908365070819855
device: cpu, dtype: torch.uint8, 100000 times 0.38267823681235313
device: cpu, dtype: torch.int16, 100000 times 0.38239253498613834
device: cpu, dtype: torch.int32, 100000 times 0.3817988149821758
device: cpu, dtype: torch.int64, 100000 times 0.3901665909215808
device: cuda, dtype: torch.int8, 100000 times 1.4211318120360374
device: cuda, dtype: torch.uint8, 100000 times 1.4215159295126796
device: cuda, dtype: torch.int16, 100000 times 1.4307750314474106
device: cuda, dtype: torch.int32, 100000 times 1.4123614141717553
device: cuda, dtype: torch.int64, 100000 times 1.4480243818834424
__ior__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.06468924414366484
device: cpu, dtype: torch.uint8, 10000 times 0.06442475505173206
device: cpu, dtype: torch.int16, 10000 times 0.05267547257244587
device: cpu, dtype: torch.int32, 10000 times 0.05286940559744835
device: cpu, dtype: torch.int64, 10000 times 0.06211103219538927
device: cuda, dtype: torch.int8, 10000 times 0.15332304500043392
device: cuda, dtype: torch.uint8, 10000 times 0.15353196952492
device: cuda, dtype: torch.int16, 10000 times 0.15300503931939602
device: cuda, dtype: torch.int32, 10000 times 0.15274472255259752
device: cuda, dtype: torch.int64, 10000 times 0.1512152962386608
```
After:
```
__or__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.2465507509186864
device: cpu, dtype: torch.uint8, 100000 times 0.2472386620938778
device: cpu, dtype: torch.int16, 100000 times 0.2469814233481884
device: cpu, dtype: torch.int32, 100000 times 0.2535214088857174
device: cpu, dtype: torch.int64, 100000 times 0.24855613708496094
device: cuda, dtype: torch.int8, 100000 times 1.4351346511393785
device: cuda, dtype: torch.uint8, 100000 times 1.4434308474883437
device: cuda, dtype: torch.int16, 100000 times 1.4520929995924234
device: cuda, dtype: torch.int32, 100000 times 1.4456610176712275
device: cuda, dtype: torch.int64, 100000 times 1.4580101007595658
__or__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.029985425993800163
device: cpu, dtype: torch.uint8, 10000 times 0.03024935908615589
device: cpu, dtype: torch.int16, 10000 times 0.026356655173003674
device: cpu, dtype: torch.int32, 10000 times 0.027377349324524403
device: cpu, dtype: torch.int64, 10000 times 0.029163731262087822
device: cuda, dtype: torch.int8, 10000 times 0.14540370367467403
device: cuda, dtype: torch.uint8, 10000 times 0.1456305105239153
device: cuda, dtype: torch.int16, 10000 times 0.1450125053524971
device: cuda, dtype: torch.int32, 10000 times 0.1472016740590334
device: cuda, dtype: torch.int64, 10000 times 0.14709716010838747
__ior__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.27195510920137167
device: cpu, dtype: torch.uint8, 100000 times 0.2692424338310957
device: cpu, dtype: torch.int16, 100000 times 0.27726674638688564
device: cpu, dtype: torch.int32, 100000 times 0.2815811652690172
device: cpu, dtype: torch.int64, 100000 times 0.2852728571742773
device: cuda, dtype: torch.int8, 100000 times 1.4743850827217102
device: cuda, dtype: torch.uint8, 100000 times 1.4766502184793353
device: cuda, dtype: torch.int16, 100000 times 1.4774163831025362
device: cuda, dtype: torch.int32, 100000 times 1.4749693805351853
device: cuda, dtype: torch.int64, 100000 times 1.5772947426885366
__ior__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.03614502027630806
device: cpu, dtype: torch.uint8, 10000 times 0.03619729354977608
device: cpu, dtype: torch.int16, 10000 times 0.0319912089034915
device: cpu, dtype: torch.int32, 10000 times 0.03319283854216337
device: cpu, dtype: torch.int64, 10000 times 0.0343862259760499
device: cuda, dtype: torch.int8, 10000 times 0.1581476852297783
device: cuda, dtype: torch.uint8, 10000 times 0.15974601730704308
device: cuda, dtype: torch.int16, 10000 times 0.15957212820649147
device: cuda, dtype: torch.int32, 10000 times 0.16002820804715157
device: cuda, dtype: torch.int64, 10000 times 0.16129320487380028
```
Fix https://github.com/pytorch/pytorch/issues/24511 , https://github.com/pytorch/pytorch/issues/24515 , https://github.com/pytorch/pytorch/issues/24658 , https://github.com/pytorch/pytorch/issues/24662 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31559
Differential Revision: D19315875
Pulled By: ezyang
fbshipit-source-id: 4a3ca88fdafbeb796079687e676228111eb44aad
2020-01-08 15:06:30 -08:00
Jessica Lin
c888473b57
Restructure docs organization and naming ( #31849 )
...
Summary:
* Rename “Other Languages” → “Language Bindings”
* Move the Community section to the bottom
* Move "Language Bindings" above "Python API"
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31849
Differential Revision: D19290966
Pulled By: jlin27
fbshipit-source-id: 30b579e032a9fb1636e4afc7bbbd85a2708f637d
2020-01-07 11:16:53 -08:00
Rohan Varma
a561a8448b
minor doc tweak to use mp.spawn in example ( #30381 )
...
Summary:
Per pietern's comment in https://github.com/pytorch/pytorch/issues/30022 , we can make this example launcher a bit simpler by using `torch.multiprocessing`.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30381
Differential Revision: D19292080
Pulled By: rohan-varma
fbshipit-source-id: 018ace945601166ef3af05d8c3e69d900bd77c3b
2020-01-06 22:19:01 -08:00
xiaobing.zhang
b47e9b97a2
Add op bitwise_and ( #31104 )
...
Summary:
Refer to https://github.com/pytorch/pytorch/pull/25665 , add `bitwise_and` operator.
Benchmark script :
```
import timeit
#for __and__
for n, t in [(10, 100000),(1000, 10000)]:
print('__and__ (a.numel() == {}) for {} times'.format(n, t))
for device in ('cpu', 'cuda'):
for dtype in ('torch.int8', 'torch.uint8', 'torch.int16', 'torch.int32', 'torch.int64'):
print(f'device: {device}, dtype: {dtype}, {t} times', end='\t\t')
print(timeit.timeit(f'a & b\nif "{device}" == "cuda": torch.cuda.synchronize()', setup=f'import torch; a = torch.randint(0, 10, ({n},), dtype = {dtype}, device="{device}"); b = torch.randint(0, 10, ({n},), dtype = {dtype}, device="{device}")', number=t))
#for __iand__
for n, t in [(10, 100000),(1000, 10000)]:
print('__iand__ (a.numel() == {}) for {} times'.format(n, t))
for device in ('cpu', 'cuda'):
for dtype in ('torch.int8', 'torch.uint8', 'torch.int16', 'torch.int32', 'torch.int64'):
print(f'device: {device}, dtype: {dtype}, {t} times', end='\t\t')
print(timeit.timeit(f'a & b\nif "{device}" == "cuda": torch.cuda.synchronize()', setup=f'import torch; a = torch.randint(0, 10, ({n},), dtype = {dtype}, device="{device}"); b = torch.tensor(5, dtype = {dtype}, device="{device}")', number=t))
```
Device: **Tesla P100, skx-8180**
Cuda verison: **9.0.176**
Before:
```
__and__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.1766007635742426
device: cpu, dtype: torch.uint8, 100000 times 0.17322628945112228
device: cpu, dtype: torch.int16, 100000 times 0.17650844901800156
device: cpu, dtype: torch.int32, 100000 times 0.17711848113685846
device: cpu, dtype: torch.int64, 100000 times 0.18240160401910543
device: cuda, dtype: torch.int8, 100000 times 1.273967768996954
device: cuda, dtype: torch.uint8, 100000 times 1.2778537990525365
device: cuda, dtype: torch.int16, 100000 times 1.2753686187788844
device: cuda, dtype: torch.int32, 100000 times 1.2797665279358625
device: cuda, dtype: torch.int64, 100000 times 1.2933144550770521
__and__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.031139614060521126
device: cpu, dtype: torch.uint8, 10000 times 0.03091452084481716
device: cpu, dtype: torch.int16, 10000 times 0.022756479680538177
device: cpu, dtype: torch.int32, 10000 times 0.025045674294233322
device: cpu, dtype: torch.int64, 10000 times 0.024164282716810703
device: cuda, dtype: torch.int8, 10000 times 0.12820732593536377
device: cuda, dtype: torch.uint8, 10000 times 0.12775669433176517
device: cuda, dtype: torch.int16, 10000 times 0.12697868794202805
device: cuda, dtype: torch.int32, 10000 times 0.12832533661276102
device: cuda, dtype: torch.int64, 10000 times 0.1280576130375266
__iand__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.3687064303085208
device: cpu, dtype: torch.uint8, 100000 times 0.36253443732857704
device: cpu, dtype: torch.int16, 100000 times 0.362891579978168
device: cpu, dtype: torch.int32, 100000 times 0.37680106051266193
device: cpu, dtype: torch.int64, 100000 times 0.3689364707097411
device: cuda, dtype: torch.int8, 100000 times 1.419940729625523
device: cuda, dtype: torch.uint8, 100000 times 1.4247053815051913
device: cuda, dtype: torch.int16, 100000 times 1.4191444097086787
device: cuda, dtype: torch.int32, 100000 times 1.4305962566286325
device: cuda, dtype: torch.int64, 100000 times 1.4567416654899716
__iand__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.06224383972585201
device: cpu, dtype: torch.uint8, 10000 times 0.06205617543309927
device: cpu, dtype: torch.int16, 10000 times 0.05016433447599411
device: cpu, dtype: torch.int32, 10000 times 0.05216377507895231
device: cpu, dtype: torch.int64, 10000 times 0.06139362137764692
device: cuda, dtype: torch.int8, 10000 times 0.14827249851077795
device: cuda, dtype: torch.uint8, 10000 times 0.14801877550780773
device: cuda, dtype: torch.int16, 10000 times 0.14952312968671322
device: cuda, dtype: torch.int32, 10000 times 0.14999118447303772
device: cuda, dtype: torch.int64, 10000 times 0.14951884001493454
```
After:
```
__and__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.23157884553074837
device: cpu, dtype: torch.uint8, 100000 times 0.23063660878688097
device: cpu, dtype: torch.int16, 100000 times 0.23005440644919872
device: cpu, dtype: torch.int32, 100000 times 0.23748818412423134
device: cpu, dtype: torch.int64, 100000 times 0.24106105230748653
device: cuda, dtype: torch.int8, 100000 times 1.4394256137311459
device: cuda, dtype: torch.uint8, 100000 times 1.4436759827658534
device: cuda, dtype: torch.int16, 100000 times 1.4631587155163288
device: cuda, dtype: torch.int32, 100000 times 1.459101552143693
device: cuda, dtype: torch.int64, 100000 times 1.4784048134461045
__and__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.028442862443625927
device: cpu, dtype: torch.uint8, 10000 times 0.028130197897553444
device: cpu, dtype: torch.int16, 10000 times 0.025318274274468422
device: cpu, dtype: torch.int32, 10000 times 0.02519288007169962
device: cpu, dtype: torch.int64, 10000 times 0.028299466706812382
device: cuda, dtype: torch.int8, 10000 times 0.14342594426125288
device: cuda, dtype: torch.uint8, 10000 times 0.145280827768147
device: cuda, dtype: torch.int16, 10000 times 0.14673697855323553
device: cuda, dtype: torch.int32, 10000 times 0.14499565307050943
device: cuda, dtype: torch.int64, 10000 times 0.14582364354282618
__iand__ (a.numel() == 10) for 100000 times
device: cpu, dtype: torch.int8, 100000 times 0.25548241566866636
device: cpu, dtype: torch.uint8, 100000 times 0.2552562616765499
device: cpu, dtype: torch.int16, 100000 times 0.25905191246420145
device: cpu, dtype: torch.int32, 100000 times 0.26635489892214537
device: cpu, dtype: torch.int64, 100000 times 0.26269810926169157
device: cuda, dtype: torch.int8, 100000 times 1.485458506271243
device: cuda, dtype: torch.uint8, 100000 times 1.4742380809038877
device: cuda, dtype: torch.int16, 100000 times 1.507783885113895
device: cuda, dtype: torch.int32, 100000 times 1.4926990242674947
device: cuda, dtype: torch.int64, 100000 times 1.519851053133607
__iand__ (a.numel() == 1000) for 10000 times
device: cpu, dtype: torch.int8, 10000 times 0.03425929415971041
device: cpu, dtype: torch.uint8, 10000 times 0.03293587639927864
device: cpu, dtype: torch.int16, 10000 times 0.029559112153947353
device: cpu, dtype: torch.int32, 10000 times 0.030915481969714165
device: cpu, dtype: torch.int64, 10000 times 0.03292469773441553
device: cuda, dtype: torch.int8, 10000 times 0.15792148280888796
device: cuda, dtype: torch.uint8, 10000 times 0.16000914946198463
device: cuda, dtype: torch.int16, 10000 times 0.1600684942677617
device: cuda, dtype: torch.int32, 10000 times 0.16162546630948782
device: cuda, dtype: torch.int64, 10000 times 0.1629159888252616
```
Fix https://github.com/pytorch/pytorch/issues/24508 , https://github.com/pytorch/pytorch/issues/24509 , https://github.com/pytorch/pytorch/issues/24655 , https://github.com/pytorch/pytorch/issues/24656 .
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31104
Differential Revision: D18938930
Pulled By: VitalyFedyunin
fbshipit-source-id: a77e805a0b84e8ace16c6e648c2f67dad44f2e44
2020-01-03 10:32:36 -08:00
vishwakftw
22d84204f7
Expose torch.poisson in documentation ( #31667 )
...
Summary:
Changelog:
- Add doc string for torch.poisson briefing current behavior
- Check for non-positive entries in the tensor passed as input to torch.poisson
Closes https://github.com/pytorch/pytorch/issues/31646
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31667
Differential Revision: D19247371
Pulled By: ngimel
fbshipit-source-id: b53d105e73bf59a45beeb566f47365c3eb74efca
2019-12-28 21:32:26 -08:00
davidriazati
ec4e347744
Add Python language reference docs ( #30686 )
...
Summary:
This exposes our audit of https://docs.python.org/3/reference/ with descriptions for each line item.
To generate the `.rst` from the Quip:
```bash
pip install m2r
m2r jit_language_reference.md
```
https://driazati.github.io/pytorch_doc_previews/30686/jit.html#python-functions-and-modules
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30686
Pulled By: driazati
Differential Revision: D19219587
fbshipit-source-id: 249db9b5ee20e38804d4302bbfeca7d54f27d0bd
2019-12-26 13:21:36 -08:00
Martin Yuan
11854bcd38
Add test to torch.jit.export_opnames, make the _C function private
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/31446
Test Plan: Imported from OSS
Differential Revision: D19172851
Pulled By: iseeyuan
fbshipit-source-id: f06d8766ed73c9abe4ebf41c402ee64880d745be
2019-12-20 13:38:43 -08:00
Elias Ellison
779b128872
add back in reference to jit_unsupported section ( #31486 )
...
Summary:
It was added in https://github.com/pytorch/pytorch/pull/31329 and removed in a bad merge in https://github.com/pytorch/pytorch/pull/31138/
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31486
Differential Revision: D19181967
Pulled By: eellison
fbshipit-source-id: 7e4b4a9b2042c30ec18f7f737bc4a9a56fac7d92
2019-12-19 12:44:16 -08:00
davidriazati
503a4e9019
Cleanup after moving language reference ( #31146 )
...
Summary:
Stacked PRs
* **#31146 - [jit] Cleanup after moving language reference**
* #31138 - [jit] Move TorchScript language reference to its own page
Preview: https://driazati.github.io/pytorch_doc_previews/jit.html#torchscript-language
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31146
Pulled By: driazati
Differential Revision: D19167390
fbshipit-source-id: f28daed36754a553264fc8ac142ed22c3e26d63e
2019-12-18 15:09:35 -08:00
davidriazati
ae2487bf4d
Move TorchScript language reference to its own page ( #31138 )
...
Summary:
Stacked PRs
* #31146 - [jit] Cleanup after moving language reference
* **#31138 - [jit] Move TorchScript language reference to its own page**
Preview: https://driazati.github.io/pytorch_doc_previews/jit.html#torchscript-language
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31138
Pulled By: driazati
Differential Revision: D19167375
fbshipit-source-id: d37110d85fc8b8d2c741be49846e873de1357c2a
2019-12-18 15:09:31 -08:00
Elias Ellison
fb30a48b4e
add unsupported section ( #31329 )
...
Summary:
Add a section for unsupported ops, and modules. Automatically generate the properties and attributes that aren't bound, and for ops that have semantic mismatches set up tests so the docs stay up to date.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31329
Differential Revision: D19164472
Pulled By: eellison
fbshipit-source-id: 46290bb8a64d9de928cfb1eda5ff4558c3799c88
2019-12-18 13:56:02 -08:00
Elliot Waite
c63f8e5ebe
Fix typo in data.rst docs
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/31395
Differential Revision: D19160010
Pulled By: zou3519
fbshipit-source-id: cbc4e719e69117e8747617729d240c72e7a4e3dd
2019-12-18 09:52:10 -08:00
Vitaly Fedyunin
3e59e80429
Revert D18941024: Move TorchScript language reference to its own page
...
Test Plan: revert-hammer
Differential Revision:
D18941024
Original commit changeset: d0ff600870a1
fbshipit-source-id: 01c0eac4c9741f27b91d710616e71a0d769f6f6a
2019-12-18 08:55:50 -08:00
davidriazati
c05538b831
Move TorchScript language reference to its own page ( #31138 )
...
Summary:
Preview: https://driazati.github.io/pytorch_doc_previews/jit.html#torchscript-language
](https://our.intern.facebook.com/intern/diff/18941024/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31138
Pulled By: driazati
Differential Revision: D18941024
fbshipit-source-id: d0ff600870a14c4a7c6ce54867d152072a12c48c
2019-12-18 00:46:19 -08:00
Michael Suo
293a139d79
add a warning for script classes ( #31069 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31069
Just to clarify that they are still experimental.
Test Plan: Imported from OSS
Differential Revision: D18920496
Pulled By: suo
fbshipit-source-id: d2f3014592a01a21f7fc60a4ce46dd0bfe5e19e9
2019-12-11 14:48:55 -08:00
Rohan Varma
dbc8b00816
Document WorkerInfo and RpcBackendOptions structures in RPC docs. ( #31077 )
...
Summary:
We mention `WorkerInfo` and `RpcBackendOptions` in a couple of different locations in our docs, and these are public classes that the user may use, so we should add the class to the documentation.
<img width="978" alt="Screen Shot 2019-12-10 at 1 42 22 PM" src="https://user-images.githubusercontent.com/8039770/70571759-47db2080-1b53-11ea-9d61-c83985a29dd9.png ">
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31077
Differential Revision: D18928162
Pulled By: rohan-varma
fbshipit-source-id: 67f11eedd87523c469377b791a0ba23704ec3723
2019-12-11 11:39:57 -08:00
Michael Suo
d02280b432
move migration guide to appendix ( #31068 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31068
Let's get it out of the early parts now that the recursive API has been
around for a while
Test Plan: Imported from OSS
Differential Revision: D18920498
Pulled By: suo
fbshipit-source-id: 6f4389739dd9e7e5f3014811b452249cc21d88e7
2019-12-10 18:04:02 -08:00
TH3CHARLie
5edfe9cb80
add torch.square ( #30719 )
...
Summary:
fixes https://github.com/pytorch/pytorch/issues/30524
This adds an new operator `torch.square` to PyTorch
I think it is ready for the first-time review now albanD
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30719
Differential Revision: D18909268
Pulled By: albanD
fbshipit-source-id: 5626c445d8db20471a56fc1d7a3490e77812662b
2019-12-10 15:22:46 -08:00
Elias Ellison
f48a8901c5
Add floor_divide function ( #30493 )
...
Summary:
Adds `torch.floor_divide` following the numpy's `floor_divide` api. I only implemented the out-of-place version, I can add the inplace version if requested.
Also fixes https://github.com/pytorch/pytorch/issues/27512
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30493
Differential Revision: D18896211
Pulled By: eellison
fbshipit-source-id: ee401c96ab23a62fc114ed3bb9791b8ec150ecbd
2019-12-10 07:51:39 -08:00
Joseph Spisak
7af9d77290
Update persons_of_interest.rst
...
Updating to add POI for mobile, quantization and an addition to optimizers.
2019-12-05 21:20:40 -08:00
davidriazati
2308a0ec1b
Improve documentation around builtin functions ( #30347 )
...
Summary:
This breaks the builtins page into some more sections and adds details about Python built-in functions
](https://our.intern.facebook.com/intern/diff/18718166/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30347
Pulled By: driazati
Reviewed By: wanchaol
Differential Revision: D18718166
fbshipit-source-id: bf43260ab7bcf92cccef684a5ce68cb16020771d
2019-12-04 13:50:40 -08:00
Nathan Goldbaum
9d3402e4cb
Add the __torch_function__ API override mechanism ( #30730 )
...
Summary:
This is a re-do of https://github.com/pytorch/pytorch/issues/27064 , which was reverted (b8792c0438 ). This was landed at the same time as other work that added new operators to the `torch` namespace so the check for whether the `torch` namespace is exhaustively checked for overridability was triggering test failures.
I've temporarily disabled that check and added an explanatory comment that the check will be re-enabled in a future PR that will be merged during a time when the commit velocity on PyTorch is lower.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30730
Differential Revision: D18813270
Pulled By: ezyang
fbshipit-source-id: 70477c4656dca8fea6e7bc59259555041fcfbf68
2019-12-04 13:19:07 -08:00
Tongzhou Wang
d0af07ca4c
Fix capitalization inconsistency in optim.rst
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30608
Differential Revision: D18808516
Pulled By: ezyang
fbshipit-source-id: 4be68be9a8c8c3da7a0b98162bc1050b588fab43
2019-12-04 08:17:03 -08:00
Edward Yang
b8792c0438
Revert D18645954: add __torch_function__ API override mechanism
...
Test Plan: revert-hammer
Differential Revision:
D18645954
Original commit changeset: 54b5e4344d7a
fbshipit-source-id: 4a7aebb483e6b001130d6f384ccc53c5a808ab13
2019-12-04 07:41:47 -08:00
Prasun Anand
d12786b24f
add __torch_function__ API override mechanism ( #27064 )
...
Summary:
Closes https://github.com/pytorch/pytorch/issues/24015 (see description of that issue for more details).
For a toy example, see the `DiagonalTensor` and `SubDiagonalTensor` class in test/test_overrides.py.
This PR currently contains:
* tests for `__torch_function__` behavior
* modification to `gen_python_functions` and `parse` function signatures and dispatched to correct overloaded argument.
This feature is inspired by and analogous to NumPy's `__array_function__` protocol ([see NumPy Enhancement Proposal 18](https://numpy.org/neps/nep-0018-array-function-protocol.html#trying-array-function-methods-until-the-right-one-works )).
### Benchmarks:
See Nathan's comment below: https://github.com/pytorch/pytorch/pull/27064#issuecomment-554601189
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27064
Differential Revision: D18645954
Pulled By: ezyang
fbshipit-source-id: 54b5e4344d7afdbcf996bb57191b0bdadc7b1767
2019-12-04 05:56:46 -08:00
Martin Yuan
b26401f965
Dump operator names of a script module ( #30467 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30467
Introduce function jit.export_opnames(module), which returns a list of all operator names used in the module and its submodules. One usage is to have mobile custom build to link only operators in the returned list to save the mobile size.
Example:
import torch
m = torch.jit.load("example.pt")
print(torch.jit.export_opnames(m))
The outputs are in alphabetical order:
['aten::_convolution', 'aten::add.Tensor', 'aten::add_.Tensor', 'aten::addmm', 'aten::append.Tensor', 'aten::cat', 'aten::dropout', 'aten::embedding', 'aten::matmul', 'aten::max.dim', 'aten::mul.Tensor', 'aten::permute', 'aten::relu', 'aten::t', 'aten::tanh', 'prim::ListConstruct', 'prim::TupleConstruct', 'prim::TupleUnpack']
Test Plan: Imported from OSS
Differential Revision: D18801619
Pulled By: iseeyuan
fbshipit-source-id: f9b198d3e82b095daf704ee595d8026ad889bb13
2019-12-03 20:20:33 -08:00
Hong Xu
bb5dcaf24f
Add logical_and and logical_or ( #30521 )
...
Summary:
With the CI failure caused in 8bbafa0b32 fixed (incorrect return type of the lambdas in CUDA kernels)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30521
Differential Revision: D18770151
Pulled By: ailzhang
fbshipit-source-id: 02f0fe1d5718c34d24da6dbb5884ee8b247ce39a
2019-12-03 18:24:54 -08:00
Joseph Spisak
4d4d8e0dce
Update persons_of_interest.rst ( #30647 )
...
Summary:
Adding back the 3 names for the MSFT team - re: ONNX Governance.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30647
Differential Revision: D18781163
Pulled By: jlin27
fbshipit-source-id: 7284ba29841ab41b9807c9d92694630b50de7b6a
2019-12-03 14:46:15 -08:00
Brian Wignall
e7fe64f6a6
Fix typos ( #30606 )
...
Summary:
Should be non-semantic.
Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30606
Differential Revision: D18763028
Pulled By: mrshenli
fbshipit-source-id: 896515a2156d062653408852e6c04b429fc5955c
2019-12-02 20:17:42 -08:00
peterjc123
6deb41c88d
Update magma to 2.5.1 for Windows and switch CUDA in CI to 9.2
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30513
Differential Revision: D18764184
Pulled By: ezyang
fbshipit-source-id: 4992869fd6a89471a5d25eb6a9b44ad8eceb480f
2019-12-02 11:56:10 -08:00
Shen Li
ec5e471647
Reorganize rpc API doc and add introduction ( #30491 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30491
Our RPC API docs presents the APIs well but misses a general
introduction to the APIs. Readers might be a little lost the first
time landing this page. This commits reorganizes the APIs into
four components from user's perspective, RPC, RRef, dist autograd,
and dist optimizer. It also adds an intro to each and briefly
discribes why we provide those.
Test Plan: Imported from OSS
Differential Revision: D18723294
Pulled By: mrshenli
fbshipit-source-id: 4aced4ab537b070aa780aaaf9724659fd47cb3cb
2019-11-28 15:34:18 -08:00
Rohan Varma
1350b99de4
Add local shutdown to process group agent ( #30330 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30330
This is now possible due to previous changes made in `gloo` and `ProcessGroupGloo`. We `abort` the listener thread that is waiting for a message, and join all other threads. The API is changed so that the previous `wait_all_workers` does not destroy the agent, and this is now done in a new `shutdown` method. All callsites are updated appropriately.
ghstack-source-id: 94673884
ghstack-source-id: 94673884
Test Plan: Unit tests pass.
Reviewed By: mrshenli
Differential Revision: D18661775
fbshipit-source-id: 5aaa7c14603e18253394224994f6cd43234301c2
2019-11-27 22:34:08 -08:00
Richard Zou
ec5c08de74
Revert D18580867: Add logical_and and logical_or
...
Test Plan: revert-hammer
Differential Revision:
D18580867
Original commit changeset: 7e4d7c37da4d
fbshipit-source-id: 81fb604c7aef8d847f518f5faa016e7bd0423016
2019-11-27 09:27:00 -08:00
Hong Xu
8bbafa0b32
Add logical_and and logical_or ( #28162 )
...
Summary:
Superseding https://github.com/pytorch/pytorch/issues/24379 as type promotion has been implemented.
Close https://github.com/pytorch/pytorch/issues/24379
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28162
Differential Revision: D18580867
Pulled By: ailzhang
fbshipit-source-id: 7e4d7c37da4dc8df87314bd4f1f6a7539e46586a
2019-11-26 17:38:22 -08:00
Santiago Castro
4eff2f2007
Fix missing closing quotes in docs
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30448
Differential Revision: D18711396
Pulled By: zou3519
fbshipit-source-id: 6e35e0779716185791273eedca7a93667a6cda90
2019-11-26 17:38:13 -08:00
davidriazati
46e7f31fa3
Document unsupported types ( #30344 )
...
Summary:
This adds a listing of the parts of the `typing` module that are unsupported
This is also a first pass decisions on features are 'unlikely to be implemented' vs 'not implemented' so they're open to discussion
](https://our.intern.facebook.com/intern/diff/18665628/ )
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30344
Pulled By: driazati
Differential Revision: D18665628
fbshipit-source-id: 22b8ebbde23df03839306cdb4344ca18a44f2c29
2019-11-26 06:53:22 -08:00
Rohan Varma
5c6705e62c
add default arg for init_method ( #30208 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30208
Adds default arg for init_method so users don't have to pass this in,
and moves it to `RpcBackendOptions` struct. Removes `init_method` arg from rpc.init_rpc. Also fixes some docs.
ghstack-source-id: 94500475
Test Plan: Unit tests pass.
Reviewed By: mrshenli
Differential Revision: D18630074
fbshipit-source-id: 04b7dd7ec96f4c4da311b71d250233f1f262135a
2019-11-25 14:52:48 -08:00
Chris Gottbrath
7c4b9042ab
Updates to quantization documentation ( #30288 )
...
Summary:
This pull request includes fixes for six quantization doc bugs.
https://github.com/pytorch/pytorch/issues/30283 - Rendering issue on QConfig
https://github.com/pytorch/pytorch/issues/26305 - Minor doc issue on fuse_modules()
https://github.com/pytorch/pytorch/issues/27451 - Issues with ConvReLU2d, ConvReLU3d, and LinearReLU doc issues
https://github.com/pytorch/pytorch/issues/26899 - Missing docstrings in torch.nn.intrinsic fused functions
https://github.com/pytorch/pytorch/issues/29735 - add discussion of QNNPack to quantization doc page
https://github.com/pytorch/pytorch/issues/27938 - some of the quantized functions lack documentation
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30288
Differential Revision: D18653368
Pulled By: gottbrath
fbshipit-source-id: 410b3dd81ff10909a7f1a7736ca42d7cabf0beb1
2019-11-23 09:29:30 -08:00
Shen Li
a9f3f48f88
Revert D5578006: Add local shutdown to process group agent
...
Test Plan: revert-hammer
Differential Revision:
D5578006
Original commit changeset: 6258879fb44c
fbshipit-source-id: 11b893b3a280a8383eeb20a0548626811616dca1
2019-11-22 11:31:04 -08:00
Rohan Varma
c478a92b93
Add local shutdown to process group agent ( #30020 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30020
This is now possible due to previous changes made in `gloo` and `ProcessGroupGloo`. We `abort` the listener thread that is waiting for a message, and join all other threads. The destructor calls this same `localShutdown` method, but we ensure this is not called multiple times.
ghstack-source-id: 94415336
Test Plan: Unit tests pass.
Differential Revision: D5578006
fbshipit-source-id: 6258879fb44c9fca97fdfad64468c1488c16ac02
2019-11-22 10:03:00 -08:00
Shen Li
aa1e99e983
Fix two links in RPC API doc
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30259
Test Plan: Imported from OSS
Differential Revision: D18644749
Pulled By: mrshenli
fbshipit-source-id: ff515d2588cd59e0d87f020a01885156a6644450
2019-11-21 19:32:22 -08:00
Shen Li
063e22b7c2
Fix RRef design doc warning ( #30240 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30240
Get rid of the following warning when build docs:
```
/Users/shenli/Project/pytorch/docs/source/notes/rref.rst:184: WARNING: Error in "code" directive:
maximum 1 argument(s) allowed, 6 supplied.
.. code::
import torch
import torch.distributed.rpc as rpc
# on worker A
rref = rpc.remote('B', torch.add, args=(torch.ones(2), 1))
# say the rref has RRefId 100 and ForkId 1
rref.to_here()
```
Test Plan: Imported from OSS
Differential Revision: D18640016
Pulled By: mrshenli
fbshipit-source-id: d527827f01183411d4b4c73e0a976bdd7fccbf49
2019-11-21 16:22:39 -08:00
Shen Li
e0325011e4
Add link to RRef protocol in RPC doc
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30218
Test Plan: Imported from OSS
Differential Revision: D18638881
Pulled By: mrshenli
fbshipit-source-id: ca6fae6f8cea8cdcc33d275dd71a347fbb5dd45c
2019-11-21 16:22:35 -08:00
Alban Desmaison
a78e7eadbd
Fix typo in extending doc
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30159
Differential Revision: D18619060
Pulled By: albanD
fbshipit-source-id: 1109c8da6242dffd6315b0c9de0f8ca34df0b276
2019-11-21 08:12:32 -08:00
Shen Li
2803261a23
Update API doc for wait_all_workers after rename
...
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/30179
Test Plan: Imported from OSS
Differential Revision: D18623092
Pulled By: mrshenli
fbshipit-source-id: 1bbffc7476f256c156783274f7ef51342820edcd
2019-11-20 16:12:30 -08:00
Rohan Varma
de05114618
polish examples in docstrings and update docs to reflect correct use of ( #30052 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30052
Some of the examples provided in `rpc/api.py` were not updated along
with the code changes, this PR updates them. Also removes the
`dist.ProcessGroup` information since `init_rpc` now initializes a default
process group.
ghstack-source-id: 94273004
Test Plan: Unit tests pass
Differential Revision: D18582596
fbshipit-source-id: a637683f0221f9600f7e50b74e9f7e5a1d331d8f
2019-11-20 15:30:38 -08:00
Shen Li
73cf4d468f
Design doc for Remote Reference ( #30066 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30066
This commit adds design reasoning and walks through four scenarios
for RRef.
Test Plan: Imported from OSS
Reviewed By: rohan-varma
Differential Revision: D18595094
Pulled By: mrshenli
fbshipit-source-id: 134102901ce515a44a2e7cd013b62143a6158120
2019-11-20 12:42:28 -08:00
Rohan Varma
f304bd5062
rename join_rpc to wait_all_workers in public api ( #30050 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30050
Renames this API to wait_all_workers as discussed.
ghstack-source-id: 94273005
Test Plan: Unit tests pass
Differential Revision: D18581466
fbshipit-source-id: 4ff5d5fb2d528f17252d5b5f30c3047d2efb92bf
2019-11-20 12:38:35 -08:00
Shen Li
ff7afede92
Stop showing .api as an API path component in RPC docs ( #30160 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30160
The path torch.distributed.rpc.api is an implementation detail, which
should not be used by applications to import RPC APIs. Instead, all
RPC APIs are exposed directly as torch.distributed.rpc.*. This
commit makes the API doc consistent with the above expectation.
Test Plan: Imported from OSS
Differential Revision: D18616359
Pulled By: mrshenli
fbshipit-source-id: 8207f7d36c24cf55af737c03a27fd1896c231641
2019-11-20 12:04:10 -08:00
Pritam Damania
88ef402cb5
Add distributed optimizer section to distributed autograd design doc. ( #30068 )
...
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30068
ghstack-source-id: 94228719
Test Plan: waitforbuildbot
Differential Revision: D18556536
fbshipit-source-id: decd6927bfdd1ee3c81fef7430aa7095d7f38d33
2019-11-19 22:43:03 -08:00