summaryrefslogtreecommitdiff
path: root/torch
AgeCommit message (Collapse)AuthorFilesLines
2019-02-06Revert D13854304: [redo][c10] LayerNorm Registration ExampleEdward Yang1-3/+0
Differential Revision: D13854304 Original commit changeset: ec463ce22721 fbshipit-source-id: 4262b9a2ef486e1c7c0283ea021331ac97cc5f56
2019-02-06Revert D13855525: [c10] Expose RoIAlign to torchEdward Yang1-2/+0
Differential Revision: D13855525 Original commit changeset: cfee7bb1544d fbshipit-source-id: 0b4124b78c4082b52e592a1275069c879a9aed39
2019-02-06Revert D13856086: [c10] Expose GenerateProposals to torchEdward Yang1-2/+0
Differential Revision: D13856086 Original commit changeset: a4873646a71a fbshipit-source-id: 79b634426404236ddbc407d3796a350ad3dae5ca
2019-02-06Revert D13864292: [c10] Expose BBoxTransform to pytorchEdward Yang1-2/+0
Differential Revision: D13864292 Original commit changeset: 1f57664e7834 fbshipit-source-id: 37663b7e8213185ecaa5c219076fc7de64704549
2019-02-06Revert D13865221: [c10] Expose BoxWithNMSLimitEdward Yang1-2/+0
Differential Revision: D13865221 Original commit changeset: 8a3f1d420183 fbshipit-source-id: 0057be9619b660dcad8c01bae67b54400127577e
2019-02-06Revert D13866214: [c10] Expose HeatmapMaxKeypoints to torchEdward Yang1-2/+0
Differential Revision: D13866214 Original commit changeset: 2ca79037fc07 fbshipit-source-id: d2c653f4f32cf0ea76875888f3523c0dc7db9960
2019-02-06Fix pip list format in collect_env (#16798)Rodrigo Berriel1-1/+1
Summary: Since pip 18.0 (2018-07-22), `legacy` is no longer a valid choice for `pip list --format` as can be seen in the [Release Notes](https://pip.pypa.io/en/stable/news/#id62). Therefore, the options now are: `columns`, `freeze` and `json`. With `legacy`, this is how it looked like: ``` [...] Versions of relevant libraries: [pip3] numpy (1.16.1) [pip3] torch (1.0.1) [pip3] torchvision (0.2.1) [...] ``` Changing to `freeze`, this is how it looks like: ``` [...] Versions of relevant libraries: [pip3] numpy==1.16.1 [pip3] torch==1.0.1 [pip3] torchvision==0.2.1 [...] ``` Currently, this is what happens: ``` [...] Versions of relevant libraries: [pip] Could not collect [...] ``` The `freeze` option is also available in old pip, so this change is backwards compatible. Also, if we would like to keep the old style, which I think it is not necessary, I could easily change that. --- In case anyone wants to know how `columns` looks like (I prefer `freeze`): ``` [...] Versions of relevant libraries: [pip3] numpy 1.16.1 [pip3] torch 1.0.1 [pip3] torchvision 0.2.1 [...] ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/16798 Differential Revision: D13971793 Pulled By: soumith fbshipit-source-id: 3721d9079a2afa245e1185f725598901185ea4cd
2019-02-05fix BUILD_CAFFE2_OPSZachary DeVito1-1/+5
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16783 Differential Revision: D13965061 Pulled By: zdevito fbshipit-source-id: 6fe710ca51e2f338873b56f23256668ca3fe2032
2019-02-05Remove unnecessary typing import. (#16777)Edward Yang1-1/+0
Summary: Signed-off-by: Edward Z. Yang <ezyang@fb.com> Pull Request resolved: https://github.com/pytorch/pytorch/pull/16777 Differential Revision: D13969679 Pulled By: ezyang fbshipit-source-id: d4728797a5927ae32628621c654eadb93c0e7682
2019-02-05Fix alias analysis for fork/wait (#16671)Michael Suo5-174/+294
Summary: (review top commit only). As expected, fork/wait introduces some corner cases into the alias analysis. The comments inline should describe the changes. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16671 Differential Revision: D13963219 Pulled By: suo fbshipit-source-id: 2bec6fc03a4989cf309fbb9473f3f2ffe2c31431
2019-02-05Warn when tracing legacy constructorsDavid Riazati2-0/+3
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16770 Differential Revision: D13963581 Pulled By: driazati fbshipit-source-id: 8f8cdfc455ba65be370fd952fc5e5c233525d002
2019-02-05Use torch.zeros for nn.LSTMDavid Riazati1-3/+3
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16779 Differential Revision: D13963577 Pulled By: driazati fbshipit-source-id: dc9edc3d2096760737ecbe4b3dd441ed2d53f4ad
2019-02-05Rename IntList to IntArrayRef. (#16751)Edward Yang30-103/+103
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16751 This was made more complicated by the fact that ivalue::IntList is a thing. So I had to fix all of the sites where we referring to IValue post facto. The following codemods were run, in this order: ``` codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in IntList IntArrayRef codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in IntArrayRef::create IntList::create codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in ivalue::IntArrayRef ivalue::IntList codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in Tag::IntArrayRef Tag::IntList codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in isIntArrayRef isIntList codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in toIntArrayRef toIntList codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in 'Shared<IntArrayRef>' 'Shared<IntList>' codemod -m -d . --extensions cc,cpp,cu,cuh,h,hpp,py,cwrap,yaml,in 'intrusive_ptr<IntArrayRef>' 'intrusive_ptr<IntList>' ``` Some manual fixups were done afterwards; they can be reviewed separately at https://github.com/pytorch/pytorch/pull/16752 Reviewed By: dzhulgakov Differential Revision: D13954363 fbshipit-source-id: b5c40aacba042402155a2f5a229fa6db7992ac64
2019-02-05dict values(), keys(), and len() (#16629)David Riazati3-17/+74
Summary: Adds some operations for dicts to match Python and tests Pull Request resolved: https://github.com/pytorch/pytorch/pull/16629 Differential Revision: D13961144 Pulled By: driazati fbshipit-source-id: b31f27a4320ff62cd118b508fb0a13056535dc7c
2019-02-05Expose HeatmapMaxKeypoints to torch (#16528)Bram Wasti1-0/+2
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16528 .. Reviewed By: smessmer Differential Revision: D13866214 fbshipit-source-id: 2ca79037fc070bade5542345af5ce09f88beda44
2019-02-05Expose BoxWithNMSLimit (#16529)Bram Wasti1-0/+2
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16529 .. Reviewed By: smessmer Differential Revision: D13865221 fbshipit-source-id: 8a3f1d420183ed5ae51b3c9e4eb6e033078c7ae4
2019-02-05Expose BBoxTransform to pytorch (#16530)Bram Wasti1-0/+2
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16530 .. Reviewed By: smessmer Differential Revision: D13864292 fbshipit-source-id: 1f57664e78347e72c0087aa3d825a6a9517c1945
2019-02-05Expose GenerateProposals to torch (#16477)Bram Wasti1-0/+2
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16477 expose generateproposals to torch Reviewed By: smessmer Differential Revision: D13856086 fbshipit-source-id: a4873646a71a6b6c01740d21729e827f4b36588f
2019-02-05Expose RoIAlign to torch (#16476)Bram Wasti1-0/+2
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16476 enable calling roialign (caffe2) from torch frontend Reviewed By: smessmer Differential Revision: D13855525 fbshipit-source-id: cfee7bb1544dc58df4231604ba01d61ca905ae3f
2019-02-05LayerNorm Registration Example (#16478)Bram Wasti1-0/+3
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16478 This diff includes an example registration of a caffe2 op in torch. A previous attempt ran into a static initialization order bug. Reviewed By: smessmer Differential Revision: D13854304 fbshipit-source-id: ec463ce2272126d08a5163d1599361ee5b718bbc
2019-02-05Enable undefined at::Tensor to be passed as Output (#16730)Bram Wasti1-3/+1
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16730 with Jerry's new updates Tensor must be defined -- as a result I've needed to update the shim for caffe2 ops being used in PyTorch Reviewed By: smessmer Differential Revision: D13946950 fbshipit-source-id: 6f77877c61a743f82bdfc2ad04d6ab583000cc18
2019-02-05Preserve method parameter names (#16750)Zachary DeVito1-5/+4
Summary: Fixes #16591 This uses uniqueBaseName so that parameters do not end up with suffixes. It changes next_id to be per-base-name rather than global to fix jittering issues when re-importing a re-numbered graph. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16750 Differential Revision: D13960282 Pulled By: zdevito fbshipit-source-id: 2156f581d9b95d77bf1f1252074e800b19116555
2019-02-05Make tuple checks faster (#16657)Adam Paszke1-2/+8
Summary: As the comment indicates, the issue is only present in some versions of Python 2, so we should be able to use heavily optimized PyTuple_Check in most cases, and skip allocation of the strings, and unnecessary lookups on object's type. cc ezyang zasdfgbnm Pull Request resolved: https://github.com/pytorch/pytorch/pull/16657 Differential Revision: D13957854 Pulled By: ezyang fbshipit-source-id: be32eb473ad77a0805e8247d8d583d673d4bdf25
2019-02-05logsumexp for multiple dimensions (#16475)Brennan Vincent2-46/+50
Summary: Move `logsumexp` and `max_values` to `TensorIterator` and use it to make `logsumexp` work for multiple dimensions. Timings on a tensor of shape `(10,1000000,10)`, for each combination of (cpu, single-threaded cpu, gpu) and dimension: **before** 208 ms ± 2.72 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 279 ms ± 5.07 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 199 ms ± 2.64 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 1.11 s ± 33.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 1.25 s ± 25.3 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 1.11 s ± 6.83 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 15.4 ms ± 1.02 µs per loop (mean ± std. dev. of 7 runs, 100 loops each) 132 ms ± 30.1 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) 39.6 ms ± 19.1 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) **after** 199 ms ± 8.23 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 307 ms ± 8.73 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 207 ms ± 7.62 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) 1.16 s ± 8.92 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 1.26 s ± 47.6 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 1.13 s ± 13.7 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) 15.4 ms ± 868 ns per loop (mean ± std. dev. of 7 runs, 100 loops each) 132 ms ± 27.6 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) 39.6 ms ± 21.8 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) Pull Request resolved: https://github.com/pytorch/pytorch/pull/16475 Differential Revision: D13855746 Pulled By: umanwizard fbshipit-source-id: aaacc0b967c3f89073487e1952ae6f76b7bd7ad3
2019-02-05Integrate PyTorch quantization APIs into ensemble export modules (#309)James Reed1-0/+4
Summary: Pull Request resolved: https://github.com/pytorch/translate/pull/309 Pull Request resolved: https://github.com/pytorch/pytorch/pull/16481 This gives us a boolean flag `quantize` on the `BeamSearch` module that allows us to apply FBGEMM quantization to a pretrained PyTorch model and export this to PyTorch native runtime. Reviewed By: jmp84 Differential Revision: D13514776 fbshipit-source-id: 3f7cbff0782aae54c9623ad1ea7e66d7f49e2b32
2019-02-05Fork/join parallelism for ensemble export modules (#310)James Reed1-0/+0
Summary: Pull Request resolved: https://github.com/pytorch/translate/pull/310 This adds fork/join parallelism to the EncoderEnsemble and DecoderBatchedStepEnsemble models. Note that when run in Python, these calls are no-op, and similarly we remove these calls before exporting to ONNX. But when we run in the PyTorch native runtime, we will now have the opportunity to run these sections in parallel. Benchmark validation is pending me slogging through FBLearner Flow issues, as usual Reviewed By: jmp84 Differential Revision: D13827861 fbshipit-source-id: 0cb9df6e10c0ba64a6b81fa374e077bce90f1d5b
2019-02-05Add an API to set the number of threads in C10 thread pool (#16669)James Reed1-1/+0
Summary: Tested locally on machine translation service Pull Request resolved: https://github.com/pytorch/pytorch/pull/16669 Differential Revision: D13927858 Pulled By: jamesr66a fbshipit-source-id: efcb8c21e0c2f76ac37967e6f52967da515595c3
2019-02-04points-to graph simplification (#16605)Michael Suo7-301/+257
Summary: This PR reworks the mutability API to be simpler (updates passes to use "mayAlias" calls) and improves the caching logic. The difference is that we now directly express the idea of a "memory location." Leaves in the alias trackers points-to graph are considered unique memory locations, and mayAlias questions can be boiled down whether two values share a leaf. To speed up queries, some basic path compression has been added. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16605 Differential Revision: D13952738 Pulled By: suo fbshipit-source-id: cfc7fb2b23369f1dc425d1d8ca2c753c193d95dd
2019-02-04Revert "Move outplace ops to ATen (#12413)" (#16731)Edward Yang2-49/+35
Summary: This reverts commit f660d3ae19decc64390e894fbaf8de80d87585e0. cc zasdfgbnm Reasoning at https://github.com/pytorch/pytorch/pull/12413#issuecomment-460424129 Pull Request resolved: https://github.com/pytorch/pytorch/pull/16731 Differential Revision: D13948022 Pulled By: ezyang fbshipit-source-id: b10669cf03679e306850314b7b5b08bed0839e19
2019-02-04Update the cmake build configuration for AppleClang compiler (#15820)JerryShih1-6/+6
Summary: This pr try to merge the https://github.com/pytorch/pytorch/pull/11563 again and fix the linking error in https://github.com/pytorch/pytorch/pull/14837. Pull Request resolved: https://github.com/pytorch/pytorch/pull/15820 Differential Revision: D13942024 Pulled By: ezyang fbshipit-source-id: dc6d1e9c4b0f177914f3745665244272a03ce33c
2019-02-02Fix issue with scalars and __rpow__ (#16687)vishwakftw1-1/+1
Summary: Changelog: - Modify __rpow__ function in tensor.py to adapt to scalars Pull Request resolved: https://github.com/pytorch/pytorch/pull/16687 Differential Revision: D13936720 Pulled By: soumith fbshipit-source-id: b0c8727968b04efbc6e7461807c812d962f03370
2019-02-01Add @ignore annotation (#16055)David Riazati7-6/+90
Summary: Adds a decorator `torch.jit.ignore` for Python functions that tells the compiler to skip over these Python values, putting a `prim::Error` in their place which always throws an exception when run. This lets you have Python-only code in your model in an explicit way, which is useful for debugging, and still be able to save/load the model. Fixes #15815 Pull Request resolved: https://github.com/pytorch/pytorch/pull/16055 Differential Revision: D13797286 Pulled By: driazati fbshipit-source-id: 29d36776608ec101649a702952fc6ff3c27655b1
2019-02-01fix tracing using a dictionary as input (#16616)Michael Suo1-1/+0
Summary: Previously this would fail with the error message: ``` ValueError: Auto nesting doesn't know how to process an input object of type dict. Accepted types: Tensors, or lists/tuples of them ``` Turns out we're not using the line that causes this error (or a side effect of that line), so removing it fixes the issue. Also cleaned up some related dead code (cc apaszke to make sure the code isn't useful in some way) Pull Request resolved: https://github.com/pytorch/pytorch/pull/16616 Differential Revision: D13908352 Pulled By: suo fbshipit-source-id: 27094f1f4ea0af215b901f7ed3520e94fbc587b3
2019-02-01Implement new c10 dispatcher (#16625)Sebastian Messmer1-10/+17
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16625 This is a squash of multiple PRs that refactored the old c10 dispatcher into a new one that follows the c10 dispatcher design doc. It is now unboxed and follows the Stack semantics from JIT. It also uses the runtime JIT schema instead of its own compile time schema definitions. Reviewed By: ezyang Differential Revision: D13907069 fbshipit-source-id: edcc4806ccd21474fdfb5a98516219b1956db13d
2019-02-01Add train() / eval() / is_training() to C++ ScriptModule API (#16044)Will Feng1-0/+21
Summary: This PR aims to fix https://discuss.pytorch.org/t/how-to-change-a-loaded-model-to-evaluation-mode-in-c/32330, by adding `train()` / `eval()` / `is_training()` to C++ ScriptModule API. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16044 Differential Revision: D13857724 Pulled By: yf225 fbshipit-source-id: 16d3969fb5840ff7e66c7f72e800e6c75db8d2ff
2019-02-01Expose backend extensions to pythonRoy Li1-0/+1
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16582 Reviewed By: gchanan Differential Revision: D13887539 fbshipit-source-id: 8755babf2e3e849af974655f2f3a91740efe977e
2019-01-31Improving docs for MultiLabelSoftMarginLoss (#16644)James Malcolm1-2/+2
Summary: Resolves #15863 Changed the documentation for MultiLabelSoftMarginLoss and MultiLabelMarginLoss to be more explicit about the `target` format. More than happy to change the messaging based on discussion. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16644 Differential Revision: D13912395 Pulled By: soumith fbshipit-source-id: 24a3c214c5f6f9d043e25b13ac758c1c1211b641
2019-01-31Add torch.backends.openmp.is_available(); fix some cmake messages (#16425)SsnL3-0/+8
Summary: 1. add `torch.backends.openmp.is_available()` 2. Improve various `cmake` outputs 3. Fix LDFLAGS not respected by `caffe2_pybind11_state_*` targets 4. Fix `MKL` warning message, and QUIET flag. 5. Fix various typos Pull Request resolved: https://github.com/pytorch/pytorch/pull/16425 Differential Revision: D13903395 Pulled By: soumith fbshipit-source-id: d15c5d46f53e1ff1c27fca2887b9d23d0bd85b4d
2019-01-31Move outplace ops to ATen (#12413)Xiang Gao2-35/+49
Summary: So that things like below can be JITable, and available in C++ API: ```python import torch torch.jit.script def f(x, y, z): x.index_add(0, y, z) ``` Pull Request resolved: https://github.com/pytorch/pytorch/pull/12413 Differential Revision: D13899948 Pulled By: suo fbshipit-source-id: b0006b4bee2d1085c813733e1037e2dcde4ce626
2019-01-31Remove constant propagation expect files (#16348)Elias Ellison1-42/+64
Summary: Remove constant prop expect files, and express graph conditions via python bindings. First diff in larger effort to remove expect files Pull Request resolved: https://github.com/pytorch/pytorch/pull/16348 Differential Revision: D13906929 Pulled By: eellison fbshipit-source-id: 7963caa3ccbc7bfc0006a160c952aa173d1ce633
2019-01-31Fix a lot of C++ build warnings (#16411)James Reed9-36/+6
Summary: I went through my build log and did what I thought were reasonable fixes to all the C++ compilation warnings that came up Pull Request resolved: https://github.com/pytorch/pytorch/pull/16411 Differential Revision: D13901006 Pulled By: jamesr66a fbshipit-source-id: 02df4e3e5a5c8dd9e69ac9f065cd3f2a80645033
2019-01-31Add immutable dict support (#16208)David Riazati13-5/+251
Summary: This PR adds basic support (creation and indexing) for immutable dictionaries in Script. This includes Python/string frontend support and a `IValue::GenericDict` type backed by a `std::unordered_map`. Only `str`, `int`, and `float` are supported as keys, any type can be a value. Structure is pretty similar to list. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16208 Differential Revision: D13881686 Pulled By: driazati fbshipit-source-id: 29ce9835b953c3456f57bcc2bbdf7fe0cbf941c0
2019-01-31Fix SIOF in torch using caffe2 registry (#16473)Bram Wasti3-3/+8
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16473 This resolves the issues associated with caffe2 initialization (specifically the REGISTER_FUNCTION_SCHEMA_OPERATOR calls) being run after Torch's static op registration calls. The fix employs a meyer's singleton wrapped by the constructor of a type. Everything is placed inside a macro to make it easier for users to use. Reviewed By: smessmer Differential Revision: D13854306 fbshipit-source-id: ecf60861f229532826fae254974e9af4389055df
2019-01-31Allow ScriptModule(optimize=False) when jit disabled (#16297)David Riazati1-1/+3
Summary: Fixes #16285 Pull Request resolved: https://github.com/pytorch/pytorch/pull/16297 Differential Revision: D13797276 Pulled By: driazati fbshipit-source-id: 3a93500d4233cfbb8f5af7feba43f6ff4c3d22c7
2019-01-31Get more fusion after autodiff uses SumToSize (#14957)Thomas Viehmann10-40/+312
Summary: Here is a fresh attempt at getting some fusion back in autodiff-generated graphs in the presence of SumToSize. - The sum to size operator is now `aten::_grad_sum_to_size` to allow symbolic script differentiation (and that in turn would need to use this in place of sum_to_size to signal that it strictly operates on gradients). This is also used in the autodiff code, replacing `prim::SumToSize`. - `_grad_sum_to_size` is now fusable, `cat`s - which are fused afterwards thanks to Adam's simplification of the code - are only fused if there is no `_grad_sum_to_size` in the fusion group. - I push the `_grad_sum_to_size` out of the the fusion group when compiling and record the desired summations in the KernelSpec. The reasoning is the following: - As the autodiff is a repeated applicaiton of the chain rule, we always have the pattern `grad_in = mm(A, grad_out)`, with A often diagonal for cases interesting to the fuser, whence it is `grad_in = a * grad_out` (a pointwise multiplication). We know that only `grad_out` may have AutodiffGradSumToSize applied, so we can commute AutodiffGradSumToSize with the `mul` (and `div` and `neg` are of similar origin). - For `type_as` the gradient might be giving the type, so just skip SumToSize, - `add` (which was inserted as `prim::AutogradAdd`) adding gradients when the forward used the same value in several places. This is non-broadcasting, so we know that the two arguments would have the same sizes as inputs - which is good so we don't have to do bookkeeping of the two parts. Details: - During fusion, the Tensor arguments are always kept as the first parameters of the fusion group to accomodate indexing assumptions in the fuser. - The rewriting of the fusion group to record the necessary output transformation and eliminate `_grad_sum_to_size` from the fusion group is now in the fuser compile step. - In the execution step, the arguments are split into Tensor / Non-Tensor and the non-tensor args are mostly forgotten about except for doing `sum_to_size` at the end. This would want to be improved if/when we fuse nonconstant scalar arguments. - In a number of places in the fuser, the non-Tensor arguments to the fusion group needed to be ignored. Thank you, apaszke for the insightful discussion. All bad ideas and errors are my own. Pull Request resolved: https://github.com/pytorch/pytorch/pull/14957 Differential Revision: D13888173 Pulled By: zou3519 fbshipit-source-id: 071992c876e8b845f2b3e6329ae03a835d39a0ea
2019-01-31Replaced "from_numpy" with "as_tensor" in docs. (#16587)sebftw1-1/+1
Summary: In the warning box on https://pytorch.org/docs/stable/tensors.html#torch.Tensor.new_tensor it says: > new_tensor() always copies data. [...] If you have a numpy array and want to avoid a copy, use **torch.from_numpy()**. But then further up the page we have another warning box with the message: > torch.tensor() always copies data. [...] If you have a numpy array and want to avoid a copy, use **torch.as_tensor()**. Now I believe this is just a small oversight, since from_numpy is to be deprecated in favour of as_tensor. See for example https://github.com/pytorch/pytorch/issues/6885 and https://github.com/pytorch/pytorch/issues/8611. I suggest to just use **torch.as_tensor()** in both of the warning boxes. cc gchanan Pull Request resolved: https://github.com/pytorch/pytorch/pull/16587 Differential Revision: D13897038 Pulled By: gchanan fbshipit-source-id: 2eb3cd47d2c0b5bf4350f980de3be9fe59b4a846
2019-01-31printing correct dimension while indexing (#16495)bhushan1-5/+5
Summary: applySelect does modify the tensor and removes the top most dimension which makes it complicated to track just using dim and need to use another parameter as real_dim to signify original dimension fixes #16192 Pull Request resolved: https://github.com/pytorch/pytorch/pull/16495 Differential Revision: D13897182 Pulled By: gchanan fbshipit-source-id: 105581dbbff6b431cc8e2539a07e0058161e53a1
2019-01-31split up AliasTracker into a separate file (#16588)Michael Suo5-371/+439
Summary: This just moves thing around to make AliasTracker independently testable and keep things a little more separate. Follow-on PRs will change the interfaces of AliasDb and AliasTracker to be more clearly distinct. Pull Request resolved: https://github.com/pytorch/pytorch/pull/16588 Differential Revision: D13891894 Pulled By: suo fbshipit-source-id: c5b590b5fdd462afefe743e499034068bf35784a
2019-01-31Access profiler from cpp (#16580)Zachary DeVito2-0/+98
Summary: jamesr66a Pull Request resolved: https://github.com/pytorch/pytorch/pull/16580 Differential Revision: D13891299 Pulled By: zdevito fbshipit-source-id: 83b335bf3231a9ab30e9318f2bce6d741ba5ffae
2019-01-30Fix: avoid race condition on model zoo directory creation (#16578)Antoine Busque1-1/+11
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