platform/upstream/pytorch.git
5 years agoFix cuFFT plan cache size on CUDA 10 cannot be set to > 4096 (#16384)
SsnL [Thu, 31 Jan 2019 14:53:57 +0000 (06:53 -0800)]
Fix cuFFT plan cache size on CUDA 10 cannot be set to > 4096 (#16384)

Summary:
Doc doesn't need to be changed. Also clarifies two inaccurate comments.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16384

Differential Revision: D13886637

Pulled By: soumith

fbshipit-source-id: 227385008211a6f3ad9135c54fd2d3754cc9daaf

5 years agoClean up binary jobs in CircleCI (#16511)
Jesse Hellemn [Thu, 31 Jan 2019 07:36:32 +0000 (23:36 -0800)]
Clean up binary jobs in CircleCI (#16511)

Summary:
- Add libtorch upload jobs
- Unify checkout and env code for binary jobs (san binary test jobs)
- Compress variables passed into binary jobs
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16511

Differential Revision: D13893714

Pulled By: pjh5

fbshipit-source-id: b8bd72e1397dec569a8ec3e859e319178c7c6f8b

5 years agoUpdating submodules
svcscm [Thu, 31 Jan 2019 07:29:16 +0000 (23:29 -0800)]
Updating submodules

Reviewed By: zpao

fbshipit-source-id: 36c332beab1aaccb281d5ee07952d399056b7f8c

5 years agomore careful use of inline/template function in perfkernels (#15388)
Jongsoo Park [Thu, 31 Jan 2019 06:46:07 +0000 (22:46 -0800)]
more careful use of inline/template function in perfkernels (#15388)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15388

This is another pass to make perfkernels code safer from illegal instruction error.
Removed dependency to c10/util/Logging.h
We're err on the safer side at the expense of some verbosity.

Reviewed By: dskhudia

Differential Revision: D13502902

fbshipit-source-id: 4f833115df885c5b4f8c1ca83b9badea1553f944

5 years agoUpdating submodules
svcscm [Thu, 31 Jan 2019 05:08:38 +0000 (21:08 -0800)]
Updating submodules

Reviewed By: zpao

fbshipit-source-id: a0a2a635f86ef3bebfb4ca1a36f7ec9c2b09d7bb

5 years agoDeviceScope support for CUDA and testing (#15357)
Jerry Zhang [Thu, 31 Jan 2019 02:26:48 +0000 (18:26 -0800)]
DeviceScope support for CUDA and testing (#15357)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15357

Supporting device option in FQ bn folding for ITER related ops

Reviewed By: wat3rBro

Differential Revision: D13370259

fbshipit-source-id: 4324c2716dfa69ddedc661ae2b1ad34c2f6fc4b6

5 years agoFix: avoid race condition on model zoo directory creation (#16578)
Antoine Busque [Thu, 31 Jan 2019 02:11:04 +0000 (18:11 -0800)]
Fix: avoid race condition on model zoo directory creation (#16578)

Summary:
The current implementation of the `torch.utils.model_zoo.load_url`
function is prone to a race condition when creating the directory in
which it saves the loaded models, since it checks whether the
directory exists and then creates it in two separate steps. The
directory can be created after the check was made but before we
attempt to create the directory, resulting in an unhandled exception.

Instead, try to create the directory directly, and do nothing if it
already exists.

Note: for Python versions ≥ 3.2, we could simply use the
`exist_ok=True` flag on `os.makedirs`, but this is unavailable in
Python 2.7.

Signed-off-by: Antoine Busque <antoine.busque@elementai.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16578

Differential Revision: D13886470

Pulled By: soumith

fbshipit-source-id: 88815c8a65eec96caea32d6e9a7f83802502fdb9

5 years agoRemove redundant declarations (#16463)
Iurii Zdebskyi [Thu, 31 Jan 2019 02:09:56 +0000 (18:09 -0800)]
Remove redundant declarations (#16463)

Summary:
As there are no checks that all the functions are actually being used, we can end up with stale entries. This diff removes unused entries from Declarations.cwrap

Testing:
Successful build via "python setup.py develop"
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16463

Differential Revision: D13885815

Pulled By: izdeby

fbshipit-source-id: 4e35c2ac9196167af74dff3d4f971210721285f8

5 years agobegin splitting up cpp tests (#16536)
Michael Suo [Thu, 31 Jan 2019 01:48:59 +0000 (17:48 -0800)]
begin splitting up cpp tests (#16536)

Summary:
Start splitting up these tests so we don't have a massive test file. Doesn't change how you run them, since `gtest.cpp` and `no-gtest.cpp` will still collect everything.

Renamed `tests.h` to `test_misc.h` to vaguely discourage people from adding yet more stuff to it.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16536

Reviewed By: zdevito, eellison

Differential Revision: D13882215

Pulled By: suo

fbshipit-source-id: 61cf97f3c2c50703dcf6a3a34da01415ecb7e7d6

5 years agoUse dispatch tensor for device_guard instead of first Tensor argument
Christian Puhrsch [Thu, 31 Jan 2019 01:19:20 +0000 (17:19 -0800)]
Use dispatch tensor for device_guard instead of first Tensor argument

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16579

Differential Revision: D13886593

Pulled By: cpuhrsch

fbshipit-source-id: 0722ec61da13c2541f7de51bf5c1ecfb9a12fad2

5 years agoEliminate PYCMD in favor of PYTHON_EXECUTABLE in CMake.
Owen Anderson [Thu, 31 Jan 2019 01:04:02 +0000 (17:04 -0800)]
Eliminate PYCMD in favor of PYTHON_EXECUTABLE in CMake.

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16522

Differential Revision: D13867376

Pulled By: resistor

fbshipit-source-id: 6bce68facea83c5161a31fcdfafe08827999eb2b

5 years agoadded example to clear ambiguity in torch.Tensor.view (#16563)
ParticularlyPythonicBS [Thu, 31 Jan 2019 00:43:51 +0000 (16:43 -0800)]
added example to clear ambiguity in torch.Tensor.view (#16563)

Summary:
Added example to the documentation of [torch.Tensor.view](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.view) to avoid the misunderstanding referenced in issue [#16560](https://github.com/pytorch/pytorch/issues/16560)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16563

Differential Revision: D13885008

Pulled By: soumith

fbshipit-source-id: b7e7fbea1f16124bc4e679ae9c50ab619e1f043d

5 years agoFix uninitialized data and broken broadcasting with sparse.mm and spa… (#16572)
Gregory Chanan [Thu, 31 Jan 2019 00:01:51 +0000 (16:01 -0800)]
Fix uninitialized data and broken broadcasting with sparse.mm and spa… (#16572)

Summary:
…rse.addmm.

Fixes https://github.com/pytorch/pytorch/issues/16543.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16572

Differential Revision: D13884235

Pulled By: gchanan

fbshipit-source-id: 308916051364d72f72ec56f0495c6c7c09845131

5 years agoadd new build files to gitignore; test that build does not leave git repo checkout...
SsnL [Wed, 30 Jan 2019 23:05:38 +0000 (15:05 -0800)]
add new build files to gitignore; test that build does not leave git repo checkout dirty (#16565)

Summary:
These appear when I run
```
MACOSX_DEPLOYMENT_TARGET=10.13 CC=clang CXX=clang++ NO_CUDA=1 NO_DISTRIBUTED=1 BUILD_CAFFE2_OPS=0 DEBUG=1 python3 setup.py develop --cmake
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16565

Differential Revision: D13885790

Pulled By: ezyang

fbshipit-source-id: af0e028d7fa7832a945aaee4e241ceb5418f4ec8

5 years agoMove Deprecated.h to c10
Edward Yang [Wed, 30 Jan 2019 21:51:14 +0000 (13:51 -0800)]
Move Deprecated.h to c10

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16504

Reviewed By: smessmer

Differential Revision: D13860570

fbshipit-source-id: 4742dc30c78d49b0f655b4e9536f51b36a595636

5 years agoAllow generic containers as module inputs (#16482)
Elias Ellison [Wed, 30 Jan 2019 21:48:36 +0000 (13:48 -0800)]
Allow generic containers as module inputs (#16482)

Summary:
Fixes https://github.com/pytorch/pytorch/issues/16326

Previously we didn't handle module inputs which included Generic Lists. When checking whether a generic list if a subvalue of the input arg type, I currently recurse on every element of the list. This shouldn't be too slow since the innermost list will be specialized and we won't have to check it's elements.

E.g. Tensor[][] -> GenericList [TensorList ].

The error message could be improved, but extracting the complete type of nested lists would have to deal with unifying types across lists / empty lists & typevars so I'm going to save that for a follow up PR.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16482

Differential Revision: D13882582

Pulled By: eellison

fbshipit-source-id: 3609bc572f0ee9ebf20a77ea5ebc8fa3b165e24b

5 years agoExplicit pdist captures (#16286)
Erik Brinkman [Wed, 30 Jan 2019 21:30:35 +0000 (13:30 -0800)]
Explicit pdist captures (#16286)

Summary:
Per discussion with cpuhrsch
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16286

Differential Revision: D13883001

Pulled By: erikbrinkman

fbshipit-source-id: 86f35d35fde5db67e3fbb09abc418da0116c9aac

5 years agoInclude ATen/core/functional.h directly instead of torch/csrc/utils/functional.h...
Mikhail Zolotukhin [Wed, 30 Jan 2019 21:30:30 +0000 (13:30 -0800)]
Include ATen/core/functional.h directly instead of torch/csrc/utils/functional.h. (#16377)

Summary:
One more shim removed.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16377

Differential Revision: D13821816

Pulled By: ZolotukhinM

fbshipit-source-id: 007f014d404de51841437db7eef28367a2f6e46b

5 years agoRemove --no-update-dependencies (#16575)
Jesse Hellemn [Wed, 30 Jan 2019 21:29:33 +0000 (13:29 -0800)]
Remove --no-update-dependencies (#16575)

Summary:
Absolutely no idea why this is needed. This should be a valid argument.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16575

Differential Revision: D13884796

Pulled By: pjh5

fbshipit-source-id: 6011e721e2870499f6b5e627d5ad00ece08b530b

5 years agoUpdate PyTorch DockerVersion to 285. (#16507)
Edward Yang [Wed, 30 Jan 2019 21:21:02 +0000 (13:21 -0800)]
Update PyTorch DockerVersion to 285. (#16507)

Summary:
Signed-off-by: Edward Z. Yang <ezyang@fb.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16507

Differential Revision: D13884588

Pulled By: ezyang

fbshipit-source-id: b7e22daa15874f9a226195d4749b4f9f827d7c1e

5 years agoSupport fallback for more operators (#16566)
Tim Khatkevich [Wed, 30 Jan 2019 21:15:59 +0000 (13:15 -0800)]
Support fallback for more operators (#16566)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16566

it's a follow-up to https://github.com/pytorch/pytorch/pull/16456

Reviewed By: yinghai

Differential Revision: D13881462

fbshipit-source-id: eff063580ac8f622477417ed4b25320299451811

5 years agofix the linter
Lu Fang [Wed, 30 Jan 2019 21:12:42 +0000 (13:12 -0800)]
fix the linter

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16567

Differential Revision: D13882166

Pulled By: houseroad

fbshipit-source-id: daf760f51e4fce376ca09421900405970d00c4d2

5 years agoAdd a test case calling caffe2 layer_norm from caffe2 executor but through the c10...
Sebastian Messmer [Wed, 30 Jan 2019 21:12:33 +0000 (13:12 -0800)]
Add a test case calling caffe2 layer_norm from caffe2 executor but through the c10 dispatcher

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16283

Reviewed By: ezyang

Differential Revision: D13792591

fbshipit-source-id: 9c190649e38e8706549102b2e136ceaf508eb37f

5 years agoBack out "[pt1][tensor] Change ConvPoolOp<Context>::SetOutputSize to ConvPoolOp<Conte...
Jerry Zhang [Wed, 30 Jan 2019 20:37:55 +0000 (12:37 -0800)]
Back out "[pt1][tensor] Change ConvPoolOp<Context>::SetOutputSize to ConvPoolOp<Context>::GetOutputSize" (#16516)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16516

Original commit changeset: 64abce3dbaed

Reviewed By: dzhulgakov

Differential Revision: D13863715

fbshipit-source-id: f1923fdca4a1a82768d9c280a8493ff15a7eb2ba

5 years agoRemove the debugging info of pytorch=>onnx coverage script (#16538)
zrphercule [Wed, 30 Jan 2019 19:23:48 +0000 (11:23 -0800)]
Remove the debugging info of pytorch=>onnx coverage script (#16538)

Summary:
Remove the debug info.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16538

Reviewed By: houseroad

Differential Revision: D13872068

Pulled By: zrphercule

fbshipit-source-id: 7572668d0048c37f6b6029a48e5ae4b8b21823f7

5 years agoCUDA histogram implementation
Jacie Fan [Wed, 30 Jan 2019 19:20:44 +0000 (11:20 -0800)]
CUDA histogram implementation

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/15842

Reviewed By: zou3519

Differential Revision: D13868982

Pulled By: jaciefan

fbshipit-source-id: bce81dc121c4538d204047506f8f14d0b4d8f905

5 years agoUse a points-to graph for alias analysis (#16386)
Michael Suo [Wed, 30 Jan 2019 19:06:32 +0000 (11:06 -0800)]
Use a points-to graph for alias analysis (#16386)

Summary:
This PR changes the way we store aliasing information from a "set" approach to a "points-to" analysis. Set-based approaches lose information in ways that make it difficult to do "live" updates to the alias DB as one as mutating the graph.

The tradeoff is that simple queries get more expensive, since they require traversing the points-to graph to answer most questions. In practice, this is unlikely to be that costly since we don't have massive aliasing chains, but we could create an approximation/caching layer if this becomes a problem.

My rough plan is:
1. This PR, switching to a points-to graph
2. Make it "live": analyzing a node should record all the edges the node added, so that we can rollback when the node is destroyed.
3. Reduce wildcard scope: we can make the wildcard a special vertex that points to anything that we're not "sure" about; namely, things that have been put inside lists, or graph inputs.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16386

Differential Revision: D13855117

Pulled By: suo

fbshipit-source-id: f009f58143173c275501624eb105d07ab60fe5e1

5 years agoONNX Export Flatten operator
Lara Haidar-Ahmad [Wed, 30 Jan 2019 18:57:08 +0000 (10:57 -0800)]
ONNX Export Flatten operator

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16240

Reviewed By: bddppq

Differential Revision: D13800025

Pulled By: houseroad

fbshipit-source-id: ae4c5e42026477b28ffd44eda2438d93936ea510

5 years agoRevert D13880053: [pytorch][PR] add new build files to gitignore; test that build...
Edward Yang [Wed, 30 Jan 2019 18:49:22 +0000 (10:49 -0800)]
Revert D13880053: [pytorch][PR] add new build files to gitignore; test that build doesn't leave repo dirty

Differential Revision:
D13880053

Original commit changeset: 0171f42438ef

fbshipit-source-id: a734f8704c1cbe16434c672289c505b19b2b490a

5 years agoAllow list and tuples to be passed as output_size to max_unpool1d (#16489)
vishwakftw [Wed, 30 Jan 2019 18:44:59 +0000 (10:44 -0800)]
Allow list and tuples to be passed as output_size to max_unpool1d (#16489)

Summary:
Changelog:
- Modify concantenation of [1] to a tuple by using cases for list and non-list types.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16489

Differential Revision: D13875838

Pulled By: soumith

fbshipit-source-id: fade65cc47385986b773b9bde9b4601ab93fe1cf

5 years agoFix the flake8 linter
Lu Fang [Wed, 30 Jan 2019 17:30:22 +0000 (09:30 -0800)]
Fix the flake8 linter

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16549

Reviewed By: bddppq

Differential Revision: D13877435

Pulled By: houseroad

fbshipit-source-id: dbe575ba3f6dd30d27ac6aa5eec2eea025063540

5 years agoadd example multiprocess code (#16345)
Ailing Zhang [Wed, 30 Jan 2019 17:27:06 +0000 (09:27 -0800)]
add example multiprocess code (#16345)

Summary: fixes #16141

Differential Revision: D13868539

Pulled By: ailzhang

fbshipit-source-id: 03e858d0aff7804c5e9e03a8666f42fd12836ef2

5 years agoSupport int64_t shape data for ideep reshape op
Yinghai Lu [Wed, 30 Jan 2019 16:55:37 +0000 (08:55 -0800)]
Support int64_t shape data for ideep reshape op

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16533

Reviewed By: jerryzh168

Differential Revision: D13867402

fbshipit-source-id: ff53a851f142ef915ad69da3868bb3aab4d48987

5 years agoadd new build files to gitignore; test that build doesn't leave repo dirty
SsnL [Wed, 30 Jan 2019 16:38:49 +0000 (08:38 -0800)]
add new build files to gitignore; test that build doesn't leave repo dirty

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16441

Differential Revision: D13880053

Pulled By: ezyang

fbshipit-source-id: 0171f42438efdd651b6af22e521b80e85b12681c

5 years agoFallback support for more operators (#16456)
Tim Khatkevich [Wed, 30 Jan 2019 11:43:48 +0000 (03:43 -0800)]
Fallback support for more operators (#16456)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16456

Adding fallbacks for more operators and fixing ifndef for expand_op.h

Reviewed By: yinghai

Differential Revision: D13845382

fbshipit-source-id: b7c5b7f7f176707b9ddffade139562a8085967ed

5 years agoFix the dropout onnx symbolic, and ensure all exported models in test_operators.py...
Lu Fang [Wed, 30 Jan 2019 09:13:16 +0000 (01:13 -0800)]
Fix the dropout onnx symbolic, and ensure all exported models in test_operators.py are eval mode (#16547)

Summary:
In eval mode, skip dropout operator in onnx exporter.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16547

Reviewed By: houseroad

Differential Revision: D13877136

Pulled By: dzhulgakov

fbshipit-source-id: c366da156f83677bcf4989b79166aae5b6c36125

5 years agoSeperate level1 elementwise functions from math (#16397)
Xiaomeng Yang [Wed, 30 Jan 2019 08:01:15 +0000 (00:01 -0800)]
Seperate level1 elementwise functions from math (#16397)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16397

Seperate level1 elementwise functions from math

i-am-not-moving-c2-to-c10

Reviewed By: houseroad

Differential Revision: D13830626

fbshipit-source-id: e6e672647076dab8b3b24be181f580a1486250c9

5 years agoFix includes for ATen/core/stack.h (#16462)
Sebastian Messmer [Wed, 30 Jan 2019 07:29:54 +0000 (23:29 -0800)]
Fix includes for ATen/core/stack.h (#16462)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16462

This file was moved, now we change the includes to the new location and remove the proxy header.

Reviewed By: ezyang

Differential Revision: D13847279

fbshipit-source-id: 4617d52fdcfe785cb7b2154460a6686c437abd8b

5 years agoAdd test case for calling c10 ops from pytorch
Sebastian Messmer [Wed, 30 Jan 2019 02:02:21 +0000 (18:02 -0800)]
Add test case for calling c10 ops from pytorch

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16062

Reviewed By: ezyang

Differential Revision: D13628955

fbshipit-source-id: f6ed3f07db2675bd9ae9251da990ca7b8c963717

5 years agoKernel gets Stack* instead of ArrayRef<IValue> (#16282)
Sebastian Messmer [Wed, 30 Jan 2019 02:02:21 +0000 (18:02 -0800)]
Kernel gets Stack* instead of ArrayRef<IValue> (#16282)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16282

This changes the core kernel abstraction to be a function taking a stack, popping its arguments from the stack and pushing results to the stack,
instead of getting arguments as ArrayRef<IValue> and returning an output IValue.

Caffe2 operators need to have a way to pass in preallocated output tensors.
The convention for them is to get all inputs *and* outputs on the stack and also return all of them, i.e. a caffe2 op will always have inputs == outputs.
This will probably change in later diffs towards making the outputs in-arguments optional in the JIT schema.

Reviewed By: ezyang

Differential Revision: D13792335

fbshipit-source-id: e9cc2b5e438cc4653e1f701633a154b92b604932

5 years agoChunk dataset implementation (#15932)
xuzhu [Wed, 30 Jan 2019 01:32:09 +0000 (17:32 -0800)]
Chunk dataset implementation (#15932)

Summary:
This PR contains the implementation of chunk dataset, with the API proposed in PR https://github.com/pytorch/pytorch/pull/15562

A chunk dataset is derived from StatefulDataset. It utilizes worker threads to prefetches chunk data, splits it into batches and caches them into a queue. When get_batch is called from dataloader, batch data is retrieved from the queue, and data in new chunks will be pushed for later following batches.

Chunk dataset uses two samplers (chunk_sampler and example_sampler) to perform sampling. The chunk_sampler decides which chunk to load, and example_sampler shuffles the examples inside a specific chunk. More detail of this sampling approach can be found here: http://martin.zinkevich.org/publications/nips2010.pdf
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15932

Differential Revision: D13868688

Pulled By: soumith

fbshipit-source-id: a43000c478ca2a3c64cc84b3626d6b8b1ad9a07e

5 years agotry to get rid of tmp_install (#16414)
Zachary DeVito [Wed, 30 Jan 2019 00:36:08 +0000 (16:36 -0800)]
try to get rid of tmp_install (#16414)

Summary:
Rehash of previous attempts. This tries a different approach where we accept the install as specified in cmake (leaving bin/ include/ and lib/ alone), and then try to adjust the rest of the files to this more standard layout.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16414

Differential Revision: D13863635

Pulled By: zdevito

fbshipit-source-id: 23725f5c64d7509bf3ca8f472dcdcad074de9828

5 years agoFix torch.sparse.sum parsing of dim. (#16517)
Gregory Chanan [Tue, 29 Jan 2019 23:32:56 +0000 (15:32 -0800)]
Fix torch.sparse.sum parsing of dim. (#16517)

Summary:
Fixes https://github.com/pytorch/pytorch/issues/16501.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16517

Differential Revision: D13865322

Pulled By: gchanan

fbshipit-source-id: fa0ac37a9e7b8f19a5bdf75e5771128e48c41612

5 years agoMake Store::setTimeout take milliseconds (#16278)
Pieter Noordhuis [Tue, 29 Jan 2019 23:31:09 +0000 (15:31 -0800)]
Make Store::setTimeout take milliseconds (#16278)

Summary:
This is particularly useful when using a c10d::Store from tests.

cc jgehring
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16278

Reviewed By: janewangfb

Differential Revision: D13866271

Pulled By: pietern

fbshipit-source-id: c8670b5f4ebd5cd009f2cabbe46cc17a9237d775

5 years agoBack out "Delete duplicate copy of THCCachingAllocator." (#16510)
Edward Yang [Tue, 29 Jan 2019 22:16:44 +0000 (14:16 -0800)]
Back out "Delete duplicate copy of THCCachingAllocator." (#16510)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16510

This diff was supposed to be memory usage neutral, but based on
some internal flows involving cuDNN, it was not. Reverting pending
further investigation.

Original commit changeset: 03f1ebf7f11c

Reviewed By: xw285cornell

Differential Revision: D13863610

fbshipit-source-id: 15517e255fd6b0c064b65fb99f0ef19742236cfd

5 years agoFix compare_exchange_weak usage in weak_intrusive_ptr (#16302)
Matthew Brandyberry [Tue, 29 Jan 2019 21:25:35 +0000 (13:25 -0800)]
Fix compare_exchange_weak usage in weak_intrusive_ptr (#16302)

Summary:
In the case of spurious failure, refcount is not incremented -- which leads to underflow once all references are released.

This was discovered when exercising multiprocessing on ppc64le.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16302

Differential Revision: D13845435

Pulled By: ezyang

fbshipit-source-id: 8e264fff9dca8152cb12617e3216d5e48acd9557

5 years agoAutomatic update of fbcode/onnx to 15c33c945851907411619f599900c3852108e7e3 (#16493)
Lu Fang [Tue, 29 Jan 2019 21:17:59 +0000 (13:17 -0800)]
update of fbcode/onnx to 15c33c945851907411619f599900c3852108e7e3 (#16493)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16493

Previous import was dc75285d4a1cff9618400164dfdb26c5a1bab70a

Included changes:
- **[15c33c9](https://github.com/onnx/onnx/commit/15c33c9)**: Add ppc64le build (#1768) <Chin Huang>
- **[198f840](https://github.com/onnx/onnx/commit/198f840)**: Update Broadcasting.md (#1769) <Verma-Rajat>
- **[60ac95f](https://github.com/onnx/onnx/commit/60ac95f)**: Merge back from release 1.4.1 (#1767) <Raymond Yang>
- **[a683372](https://github.com/onnx/onnx/commit/a683372)**: Bump up version number for v1.4.0 (#1761) (#1763) <Raymond Yang>
- **[dbf3581](https://github.com/onnx/onnx/commit/dbf3581)**: Add TfIdfVectorizer operator to ONNX (#1721) <Dmitri Smirnov>

Reviewed By: zrphercule

Differential Revision: D13858840

fbshipit-source-id: 1d00f63f265cc6deed965b92ed00c44f547ff03e

5 years agoMake the pytorch's cmake minimum required version equal to caffe2's. (#16506)
Edward Yang [Tue, 29 Jan 2019 21:13:30 +0000 (13:13 -0800)]
Make the pytorch's cmake minimum required version equal to caffe2's. (#16506)

Summary:
Stack:
&nbsp;&nbsp;&nbsp;&nbsp;:black_circle:&nbsp; **#16506 Make the pytorch's cmake minimum required version equal to caffe2's.**&nbsp;&nbsp;[:yellow_heart:](https://our.intern.facebook.com/intern/diff/D13861564/)

Originally authored by JerryShih <bignose1007@gmail.com>
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16506

Differential Revision: D13863979

Pulled By: ezyang

fbshipit-source-id: 9275739a820ae03ec6eaa41959f9340c9bba8de3

5 years agoMore windows fixes towards the code refactor (#16451)
peter [Tue, 29 Jan 2019 20:37:37 +0000 (12:37 -0800)]
More windows fixes towards the code refactor (#16451)

Summary:
Fixes #16446.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16451

Differential Revision: D13864388

Pulled By: soumith

fbshipit-source-id: 6cb173eafbd3da33c479c56c85aff75e8be4bf35

5 years agoAdd stack & cat support for CPU Half (#16389)
SsnL [Tue, 29 Jan 2019 20:23:06 +0000 (12:23 -0800)]
Add stack & cat support for CPU Half (#16389)

Summary:
Fixes https://github.com/pytorch/pytorch/issues/6968

Needed for #14705
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16389

Differential Revision: D13861446

Pulled By: gchanan

fbshipit-source-id: 7b8700b95aaf252d9669693dbddccb2302e58409

5 years agoAdd some smoke tests for Windows
peter [Tue, 29 Jan 2019 20:04:56 +0000 (12:04 -0800)]
Add some smoke tests for Windows

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16496

Differential Revision: D13863489

Pulled By: soumith

fbshipit-source-id: 518003c27a6b788b5a78b58cdb8698f0bb6ce4d8

5 years agocreate type hint stub files for module torch (#12500)
Thomas Viehmann [Tue, 29 Jan 2019 19:19:51 +0000 (11:19 -0800)]
create type hint stub files for module torch (#12500)

Summary:
We have:

- This is an initial stab at creating a type stub `torch/__init__.pyi` .
- This is only tested on Python 3, since that's the only Python version mypy
  works on.
- So far, we only aim at doing this for torch functions and torch.Tensor.
- Quite a few methods and functions have to be typed manually. These are
  done in `torch/__init__.pyi.in`

For me, PyCharm (the non-paid one) didn't seem to indicate errors in the .pyi when opening and seemed to be able to get the type hint for the few functions I tried, but I don't use PyCharm for my usual PyTorch activities, so I didn't extensively try this out.

An example of a generated PYI is at [this gist](https://gist.github.com/ezyang/bf9b6a5fa8827c52152858169bcb61b1).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/12500

Differential Revision: D13695553

Pulled By: ezyang

fbshipit-source-id: 4566c71913ede4e4c23ebc4a72c17151f94e8e21

5 years agoRevert D13596031: Improve c2-aten tensor interop and add proper testing
Edward Yang [Tue, 29 Jan 2019 15:11:47 +0000 (07:11 -0800)]
Revert D13596031: Improve c2-aten tensor interop and add proper testing

Differential Revision:
D13596031

Original commit changeset: d20b601e06ba

fbshipit-source-id: dc371697f14b3893a9164380a39e7a49d8d68ecf

5 years agourl download bugfix for URLs served without Content-Length header (#16153)
Soumith Chintala [Tue, 29 Jan 2019 09:26:22 +0000 (01:26 -0800)]
url download bugfix for URLs served without Content-Length header (#16153)

Summary:
Some HTTP servers dont return Content-Length, account for that

Fixes: https://github.com/pytorch/pytorch/issues/16152

Differential Revision: D13858882

Pulled By: soumith

fbshipit-source-id: e4293e9368ed4c87548d22adec1ce0c25ea4bd8f

5 years agoProperly screen string literals when dumping JIT IR
Mikhail Zolotukhin [Tue, 29 Jan 2019 08:17:30 +0000 (00:17 -0800)]
Properly screen string literals when dumping JIT IR

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16056

Differential Revision: D13719444

Pulled By: ZolotukhinM

fbshipit-source-id: 7113ee9328eff6263513476cdf9254a2e1116f4c

5 years agoRemove dependency on ResourceGuard from IR.h. (#16351)
Mikhail Zolotukhin [Tue, 29 Jan 2019 08:15:17 +0000 (00:15 -0800)]
Remove dependency on ResourceGuard from IR.h. (#16351)

Summary:
It looks like `WithInsertionPoint` and `WithCurrentScope` can be easily implemented without
`ResourceGuard` - that helps readability and removes one more dependency. Is there anything I'm missing?
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16351

Differential Revision: D13821826

Pulled By: ZolotukhinM

fbshipit-source-id: b203200b345fb5508a97dc8656e6f51cde4cc21f

5 years agoRemove redundant includes from scope.h and attributes.h
Mikhail Zolotukhin [Tue, 29 Jan 2019 07:44:31 +0000 (23:44 -0800)]
Remove redundant includes from scope.h and attributes.h

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16472

Differential Revision: D13852553

Pulled By: ZolotukhinM

fbshipit-source-id: d5634982c2c42e704d9902774a77660e05fd71eb

5 years agoImprove c2-aten tensor interop and add proper testing (#15860)
Dmytro Dzhulgakov [Tue, 29 Jan 2019 07:39:17 +0000 (23:39 -0800)]
Improve c2-aten tensor interop and add proper testing (#15860)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15860

Few changes (which are harder to split in separate diffs, so together):
- make conversion explicit (as they can throw to avoid surprises)
- fix tensor legacy dispatch not initialized when tensor is created on C2 side
- add a bunch of invariants to enforce

Reviewed By: ezyang

Differential Revision: D13596031

fbshipit-source-id: d20b601e06ba47aeff2f6e8e15769840e2d46108

5 years agoRemove redundant "build" setup.py commond from onnx scripts
Your Name [Tue, 29 Jan 2019 06:56:55 +0000 (22:56 -0800)]
Remove redundant "build" setup.py commond from onnx scripts

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16487

Differential Revision: D13858628

Pulled By: bddppq

fbshipit-source-id: e1ff3fc5f9be5d3dbbf96ee73c3a8c901b440b82

5 years agoFix identifier shadowing in tracer (#16480)
James Reed [Tue, 29 Jan 2019 05:44:33 +0000 (21:44 -0800)]
Fix identifier shadowing in tracer (#16480)

Summary:
This was causing build failures under `-Werror` targets under optimized build modes
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16480

Differential Revision: D13857621

Pulled By: jamesr66a

fbshipit-source-id: 2990b987dbca943298ad478c9ee2792236f5fa5b

5 years agoPass WERROR to CMake as an explicit parameter rather than an env var.
Owen Anderson [Tue, 29 Jan 2019 04:51:52 +0000 (20:51 -0800)]
Pass WERROR to CMake as an explicit parameter rather than an env var.

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16465

Differential Revision: D13853949

Pulled By: resistor

fbshipit-source-id: 71ccf90a2824ad21c9f26dd753b186f30435d82a

5 years agoRemove redundant build from build develop instructions
Edward Yang [Tue, 29 Jan 2019 04:43:59 +0000 (20:43 -0800)]
Remove redundant build from build develop instructions

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16467

Differential Revision: D13849661

Pulled By: ezyang

fbshipit-source-id: d3d58bd31ac65ad9cbf0057b9a4c499c0f59d95a

5 years agoChange SetOutputSize in ConvTransposeUnpoolBaseOp (#16179)
Jerry Zhang [Tue, 29 Jan 2019 02:24:42 +0000 (18:24 -0800)]
Change SetOutputSize in ConvTransposeUnpoolBaseOp (#16179)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16179

to avoid passing partially initialized Tensor around.

Reviewed By: ezyang

Differential Revision: D13744009

fbshipit-source-id: 4c545765e1cd164b3e87ce08ec4c1cb1e37e2b8f

5 years agoMove stack.h to ATen/core (#16247)
Sebastian Messmer [Tue, 29 Jan 2019 01:38:38 +0000 (17:38 -0800)]
Move stack.h to ATen/core (#16247)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16247

Stack is going to be used by the c10 dispatcher.
This just moves the file, also changing the namespace turned out to be more complicated than I thought, I'll leave the namespace for now.

Reviewed By: ezyang

Differential Revision: D13774189

fbshipit-source-id: 66aeee36425e0ea2b3a4f8159604f38572306d57

5 years agoRemove state from schema and calling API (#16180)
Sebastian Messmer [Tue, 29 Jan 2019 01:38:38 +0000 (17:38 -0800)]
Remove state from schema and calling API (#16180)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16180

Only the kernel knows about its state, the caller doesn't see it anymore.

Reviewed By: ezyang

Differential Revision: D13744071

fbshipit-source-id: cb00ff1a881508c1b36ac4123bee1f68ca02ca9c

5 years agoRemove generic_if.h. (#16354)
Mikhail Zolotukhin [Tue, 29 Jan 2019 00:56:44 +0000 (16:56 -0800)]
Remove generic_if.h. (#16354)

Summary:
The current uses of `IR_IF` are mostly trivial, so there is not much value in having special macros for it.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16354

Differential Revision: D13821823

Pulled By: ZolotukhinM

fbshipit-source-id: 1ca73111f5b4868fa38a1f29c9230540773e5de6

5 years agoRemove CUDA_VERSION to flag and remove JOB_BASE_NAME from binary jobs
Jesse Hellemn [Tue, 29 Jan 2019 00:49:25 +0000 (16:49 -0800)]
Remove CUDA_VERSION to flag and remove JOB_BASE_NAME from binary jobs

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16470

Differential Revision: D13853387

Pulled By: pjh5

fbshipit-source-id: a2baccde65ab82b69380ee57b16e43cc80ed3e04

5 years agoFix cmake byte version issue in build_pytorch_libs.
Gregory Chanan [Mon, 28 Jan 2019 23:54:04 +0000 (15:54 -0800)]
Fix cmake byte version issue in build_pytorch_libs.

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16457

Differential Revision: D13846408

Pulled By: gchanan

fbshipit-source-id: 26962bc12d7d9fdad71f9dd7526f6d32e6008295

5 years agoChange ConvPoolOp<Context>::SetOutputSize to ConvPoolOp<Context>::GetOutputSize ...
Jerry Zhang [Mon, 28 Jan 2019 23:51:25 +0000 (15:51 -0800)]
Change ConvPoolOp<Context>::SetOutputSize to ConvPoolOp<Context>::GetOutputSize (#16273)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16273

Previously we have SetOutputSize which accept a partially initialized Output Tensor and set it to the correct size,
the diff change this to GetOutputSize that returns the correct size instead.
e.g.
```
auto* Y = Output(0);
ConvPoolOp<Context>::SetOutputSize(X, Y, channels);
...
Y->mutable_data<T>...
```
-->
```
auto sizes = ConvPoolOp<Context>::GetOutputSize(X, channels);
auto* Y = Output(0, sizes, at::dtype<T>());
```

Reviewed By: dzhulgakov

Differential Revision: D13736281

fbshipit-source-id: 64abce3dbaed0b375098463333dfd0ea5a3b1945

5 years agoMove tracer impls into cpp file (#16410)
James Reed [Mon, 28 Jan 2019 23:22:08 +0000 (15:22 -0800)]
Move tracer impls into cpp file (#16410)

Summary:
Working on the tracer was really annoying because a lot of the implementations were in `tracer.h` and editing that file caused us to rebuild almost the whole world. So this moves all the implementations into tracer.cpp
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16410

Differential Revision: D13847776

Pulled By: jamesr66a

fbshipit-source-id: ec8500da32b2d4cd990f293a0a96101d3e82f158

5 years agofix alias annotations on to, cpu, cuda (#16460)
Michael Suo [Mon, 28 Jan 2019 23:04:53 +0000 (15:04 -0800)]
fix alias annotations on to, cpu, cuda (#16460)

Summary:
Fix alias annotations for ops that may return a fresh tensor. The previous version was overly conservative.

Currently there is no actual behavior change in the alias analysis, but we may use the information in the future.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16460

Differential Revision: D13849086

Pulled By: suo

fbshipit-source-id: cd23b314a800e5e077d866e74456d37a321439d5

5 years agoRemove usage of deprecated "min_satisfying_examples" hypothesis setting (#16401)
Your Name [Mon, 28 Jan 2019 22:01:30 +0000 (14:01 -0800)]
Remove usage of deprecated "min_satisfying_examples" hypothesis setting (#16401)

Summary:
This setting has been deprecated in [hypythesis 3.56.0](https://github.com/HypothesisWorks/hypothesis/blob/d1b0df5b91051de7d3f9cea6550ce31e9f0ee2c8/hypothesis-python/docs/changes.rst#3560---2018-04-17) and recently has been removed in [hypothesis 4.x](https://github.com/HypothesisWorks/hypothesis/blob/d1b0df5b91051de7d3f9cea6550ce31e9f0ee2c8/hypothesis-python/docs/changes.rst#400---2019-01-14).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16401

Reviewed By: ezyang

Differential Revision: D13832528

Pulled By: bddppq

fbshipit-source-id: 04b9f1dfdf2dcfe0ef121dd02f7fbfdf6bf4aead

5 years agoSupport Tensor alias annotations for native_functions.yaml (#16239)
Christian Puhrsch [Mon, 28 Jan 2019 21:54:14 +0000 (13:54 -0800)]
Support Tensor alias annotations for native_functions.yaml (#16239)

Summary:
Adds Tensor alias annotations.

This isn't a full implementation of alias annotations, but that isn't required to increase compliance with the JIT signature schema. There are some sanity checks within native_parse.py for their usage, which can also help overall correctness. Otherwise, this exists solely for further alignment between the JIT signature schema and the native_functions.yaml func schema.

This gets us to ~85% matches.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16239

Differential Revision: D13804133

Pulled By: cpuhrsch

fbshipit-source-id: aa5750f2c7e0f08b8c35d6d8f38cb148e9629855

5 years agoAnnotate the bicubic interpolation kernels (#16449)
Johannes M Dieterich [Mon, 28 Jan 2019 21:35:48 +0000 (13:35 -0800)]
Annotate the bicubic interpolation kernels (#16449)

Summary:
with the correct `__launch_bounds__` for ROCm.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16449

Differential Revision: D13844111

Pulled By: bddppq

fbshipit-source-id: 07ed8552a630f3a6426d9e5648c415f066991e3d

5 years agoClear cmake cache when --cmake (#16426)
SsnL [Mon, 28 Jan 2019 21:35:36 +0000 (13:35 -0800)]
Clear cmake cache when --cmake (#16426)

Summary:
Also, because sometimes we have `CMakeCache.txt` but cmake errored out so I'm adding the existence of `'build.ninja'` as another criterion of rerunning cmake.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16426

Differential Revision: D13843801

Pulled By: ezyang

fbshipit-source-id: ea1efb201062f23b7608f8d061997d8a8e293445

5 years agoRemove dims() in caffe2::Tensor (#16356)
Jerry Zhang [Mon, 28 Jan 2019 20:18:19 +0000 (12:18 -0800)]
Remove dims() in caffe2::Tensor (#16356)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16356

att

Reviewed By: dzhulgakov

Differential Revision: D13813197

fbshipit-source-id: 68c0fb43404536f622422c51949c819d8a037aa5

5 years agoOp-calling API can handle state (#16177)
Sebastian Messmer [Mon, 28 Jan 2019 19:36:31 +0000 (11:36 -0800)]
Op-calling API can handle state (#16177)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16177

Change the API for calling operators so that it can store state in an OpKernel object.
This diff doesn't store the state there yet, that comes in a follow up diff.

Reviewed By: ezyang

Differential Revision: D13742889

fbshipit-source-id: 20511a9a1b9f850074e50634d4b4acf87f8c6ecd

5 years agoHandle stack correctly (#16246)
Sebastian Messmer [Mon, 28 Jan 2019 19:36:30 +0000 (11:36 -0800)]
Handle stack correctly (#16246)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16246

The op schema says it returns multiple values, so let's actually return multiple values instead of one tuple.
For some reason, this did work when called from python (probably some auto-unpacking),
but once called from JIT, it segfaulted. This diff fixes that.

Reviewed By: dzhulgakov

Differential Revision: D13780147

fbshipit-source-id: fe94f82f4c53b7454f77c4484fca4ac9dc444475

5 years agoFix compiler error in swapBytes64 for rare architectures (#16418)
Helmut [Mon, 28 Jan 2019 19:25:33 +0000 (11:25 -0800)]
Fix compiler error in swapBytes64 for rare architectures (#16418)

Summary:
swapBytes64 used to use SwapByteOrder_32 and value, both of which dont exist. This commit rewrites that part from scratch.
This happened on Debugbuild on Microsoft compiler. For that case " && !defined(_DEBUG)" is also removed, because _byteswap_uint64 works fine in debug mode (if it is necessary it should me commented why).
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16418

Differential Revision: D13843306

Pulled By: ezyang

fbshipit-source-id: dde1c7baeccec3aaa750d4b7200b3f4ccb4a00cb

5 years agoFix lint errors introduced in pytorch/pytorch@ceece5d (#16454)
Junjie Bai [Mon, 28 Jan 2019 19:10:18 +0000 (11:10 -0800)]
Fix lint errors introduced in pytorch/pytorch@ceece5d (#16454)

Summary:
ifedan

```
./test/common_utils.py:748:1: E302 expected 2 blank lines, found 1
./test/test_torch.py:1235:5: E303 too many blank lines (2)
```
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16454

Differential Revision: D13844905

Pulled By: bddppq

fbshipit-source-id: 3dc7c740d86310a8efc9864d7c7798fda8257a21

5 years agoReport the slowest 10 tests when using pytest (#16423)
Syed Tousif Ahmed [Mon, 28 Jan 2019 18:20:47 +0000 (10:20 -0800)]
Report the slowest 10 tests when using pytest (#16423)

Summary:
This flag is useful in identifying if a test is taking way too long like the ones in the following snippet when running the test suite with pytest. https://github.com/pytorch/pytorch/blob/9757ad35b0b56cf955f294e751de9b437f9bb4ff/test/common_utils.py#L814-L835
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16423

Differential Revision: D13843507

Pulled By: ezyang

fbshipit-source-id: 643e1766a85905b3b112ea5ca562135a17896a72

5 years agoOptimize SpatialBNOp on GPU (#16395)
Xiaomeng Yang [Mon, 28 Jan 2019 17:26:41 +0000 (09:26 -0800)]
Optimize SpatialBNOp on GPU (#16395)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16395

Optimize SpatialBNOp on GPU

i-am-not-moving-c2-to-c10

Reviewed By: houseroad

Differential Revision: D13829833

fbshipit-source-id: 04d2a63e8e9830c4c39a91cf87fcd7aa765dc55f

5 years agoCPU implementation of torch.cdist (#16168)
Igor Fedan [Mon, 28 Jan 2019 17:14:07 +0000 (09:14 -0800)]
CPU implementation of torch.cdist (#16168)

Summary:
cdist is used for calculating distances between collections of observations.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16168

Differential Revision: D13739147

Pulled By: ifedan

fbshipit-source-id: 9419c2c166891ac7db40672c72f17848f0b446f9

5 years agoDon't initialize a new `std::vector` in a loop. (#15850)
Brennan Vincent [Mon, 28 Jan 2019 16:47:35 +0000 (08:47 -0800)]
Don't initialize a new `std::vector` in a loop. (#15850)

Summary:
Before this diff, we execute `std::vector<optional<acc_t>> buffer((unsigned)max_threads, optional<acc_t> {});` in every iteration of `foreach_reduced_elt`. Change the code to only execute that line if we need it; i.e., we are actually about to parallelize.

This overhead is quite significant when we are doing a lot of small reductions in single-threaded code.

```
x=torch.randn((1024,10,1024),dtype=torch.float64)
torch.set_num_threads(1)
%timeit x.std(1)
```

Before (with #15845 applied): 708.25 ms
After: 508 ms
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15850

Differential Revision: D13612960

Pulled By: umanwizard

fbshipit-source-id: f5e61abfe0027775c97ed81ac09c997fbee741df

5 years agoMore documentation on caffe2::Operator
Edward Yang [Mon, 28 Jan 2019 15:37:43 +0000 (07:37 -0800)]
More documentation on caffe2::Operator

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16371

Reviewed By: dzhulgakov

Differential Revision: D13820472

fbshipit-source-id: efccea0e92c86d30ec2bdda50eb9aab8a3a1504d

5 years agoBetter error message when creating a module instance in jit.script (#16416)
rotuna [Mon, 28 Jan 2019 00:26:47 +0000 (16:26 -0800)]
Better error message when creating a module instance in jit.script (#16416)

Summary:
Made the change requested in #15555

PR was failing build due to a time out error while getting packages using pip.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16416

Differential Revision: D13833873

Pulled By: soumith

fbshipit-source-id: e2200e9e8015558fcd359dfa3d025b25802d62b5

5 years agoFix issues on Windows brought by #16289 (#16412)
peter [Sun, 27 Jan 2019 22:59:34 +0000 (14:59 -0800)]
Fix issues on Windows brought by #16289 (#16412)

Summary:
This one needs to be merged ASAP because the CUDA build for Windows is skipped at this time.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16412

Differential Revision: D13833889

Pulled By: soumith

fbshipit-source-id: 95a401a01fb0f9c1045df0bfd72d8206b8a6f3fd

5 years agoFix a typo in Parallel.h (#16419)
Gemfield [Sun, 27 Jan 2019 22:13:46 +0000 (14:13 -0800)]
Fix a typo in Parallel.h (#16419)

Summary:
Fix a typo in Parallel.h.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16419

Differential Revision: D13833705

Pulled By: soumith

fbshipit-source-id: 824ebe753e028fc8e2b5d7a51fdba98a365fd29a

5 years agoDon't install PDB for Windows static build of caffe2_observers (#16420)
peterjc123 [Sun, 27 Jan 2019 20:26:24 +0000 (12:26 -0800)]
Don't install PDB for Windows static build of caffe2_observers (#16420)

Summary:
Fixes #16292.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16420

Differential Revision: D13833704

Pulled By: soumith

fbshipit-source-id: 482ad6ce103bed7206e924e8c82454fbb1bfac42

5 years agoFix slogdet sign requiring grad when input requires grad (#16337)
SsnL [Sun, 27 Jan 2019 20:08:09 +0000 (12:08 -0800)]
Fix slogdet sign requiring grad when input requires grad (#16337)

Summary:
The real fix for https://github.com/pytorch/pytorch/issues/15605.

This is sort of BC breaking because now
```py
In [1]: import torch

In [2]: a = torch.randn(3, 3, requires_grad=True)

In [3]: a.slogdet()
Out[3]: (tensor(1.), tensor(0.1356, grad_fn=<SlogdetBackward>))

In [4]: a.slogdet()[0].requires_grad
Out[4]: False
```
while before this patch ` a.slogdet()[0]` requires grad with `grad_fn=<SlogdetBackward>`. But any use of backproping through this value will meet the error in #15605 so I don't think this is a problem.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16337

Differential Revision: D13832644

Pulled By: soumith

fbshipit-source-id: f96c477e99edcbdbd966888e5c5ea7fd058429a8

5 years agoCI Fix: restore MAX_JOBS variable (#16415)
Zachary DeVito [Sun, 27 Jan 2019 09:24:58 +0000 (01:24 -0800)]
CI Fix: restore MAX_JOBS variable (#16415)

Summary:
Restores a CI workaround (https://github.com/pytorch/pytorch/pull/7361) that got dropped with build_pytorch_libs.sh.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16415

Differential Revision: D13833092

Pulled By: zdevito

fbshipit-source-id: f78b60cafd8da945790dba28de373b8faf46e9f5

5 years agoUpdate einsum documentation. (#16323)
Samuel Fadel [Sun, 27 Jan 2019 01:58:31 +0000 (17:58 -0800)]
Update einsum documentation. (#16323)

Summary:
The documentation stated that operands to einsum should be a list of Tensors, not individual arguments. The function, however, now accepts individual arguments for each Tensor operand *and* a single argument consisting of a list of Tensors. The documentation was updated to reflect this change.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16323

Differential Revision: D13832647

Pulled By: soumith

fbshipit-source-id: c01c2b350f47674d3170337f493b0ee2ea381b3f

5 years agoFix flake8 warnings/errors in test_jit.py (#16409)
James Reed [Sun, 27 Jan 2019 01:39:34 +0000 (17:39 -0800)]
Fix flake8 warnings/errors in test_jit.py (#16409)

Summary:
These were really annoying to see in the phabricator UI when trying to land PRs that touched test_jit.py, so this fixes them.

One remaining item is the T484 error. Locally, flake8 still chokes on that line even though I put the noqa comment there (and tried varying whitespaces around it etc). Not sure why it still persists...
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16409

Differential Revision: D13832658

Pulled By: jamesr66a

fbshipit-source-id: 46356ba6444ae5ee1a141c28489bdcc7c99e39c0

5 years agoTrace fork and join calls
James Reed [Sat, 26 Jan 2019 22:38:12 +0000 (14:38 -0800)]
Trace fork and join calls

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16232

Differential Revision: D13772974

Pulled By: jamesr66a

fbshipit-source-id: b2db370271809e26d3301f8cc98eec567db5e62b

5 years agoSwitch to CUDA implementation if batch size >= 65536 for affine_grid (#16403)
vishwakftw [Sat, 26 Jan 2019 19:14:19 +0000 (11:14 -0800)]
Switch to CUDA implementation if batch size >= 65536 for affine_grid (#16403)

Summary:
Changelog:

- Append a condition that switches to the native CUDA implementation for affine_grid

Fixes #16365

Differential Revision: D13832192

Pulled By: soumith

fbshipit-source-id: 3f484e6673d71e3ba7627b170cb8f1611e12b9b2

5 years agogitignore gdb history
SsnL [Sat, 26 Jan 2019 17:42:48 +0000 (09:42 -0800)]
gitignore gdb history

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16404

Differential Revision: D13832191

Pulled By: soumith

fbshipit-source-id: ab23d1ad72c041ec2d9616c273bbf399e0feb10d

5 years agoRevert D13821061: [redo][c10] layernorm example
Juan Miguel Pino [Sat, 26 Jan 2019 06:49:00 +0000 (22:49 -0800)]
Revert D13821061: [redo][c10] layernorm example

Differential Revision:
D13821061

Original commit changeset: 82f0dade0145

fbshipit-source-id: e5b0b1bab0c9e731ae04add35e9a6c91656dd178

5 years agotrying to fix testX (#16370)
Jerry Zhang [Sat, 26 Jan 2019 00:59:07 +0000 (16:59 -0800)]
trying to fix testX (#16370)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16370

passed locally but seems testX has some problem

Reviewed By: ezyang

Differential Revision: D13820250

fbshipit-source-id: e4ad9d1ec99508867d4ead46753a7fb7019c50bd

5 years agolayernorm example (#16374)
Bram Wasti [Sat, 26 Jan 2019 00:45:35 +0000 (16:45 -0800)]
layernorm example (#16374)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16374

this fixes the original attempt in OSS (adds to CMake and python build files)

Reviewed By: smessmer

Differential Revision: D13821061

fbshipit-source-id: 82f0dade0145fd04bdf8e3cb3954b5790e918162

5 years agoplug caffe2 into jit" (#16388)
Bram Wasti [Sat, 26 Jan 2019 00:45:34 +0000 (16:45 -0800)]
plug caffe2 into jit" (#16388)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16388

previous diff broke master -- this refactors out the custom_operator.cpp file into a separate header + cpp pair (caffe2_operator.{h,cpp})

Reviewed By: smessmer

Differential Revision: D13823550

fbshipit-source-id: 00e005e650336132d05aef97c1f0e5242ccad5ba