Commit Graph

35 Commits

Author SHA1 Message Date
4fd16dd8aa Clarify that libtorch API is C++17 compatible (#136471)
As it relies on some common C++17 primitives, such as `std::optional`
Replace all docs references from C++14 to C++17

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

Pull Request resolved: https://github.com/pytorch/pytorch/pull/136471
Approved by: https://github.com/kit1980, https://github.com/atalman
2024-09-24 02:03:33 +00:00
e8645fa2b9 [Doc] fix some typos (found by codespell and typos) (#132544)
Applying doc fixes from PR https://github.com/pytorch/pytorch/pull/127267 - with CLA
Pull Request resolved: https://github.com/pytorch/pytorch/pull/132544
Approved by: https://github.com/kit1980
2024-08-05 17:21:56 +00:00
d425da8bf3 Replace master with main in links and docs/conf.py (#100176)
Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100176
Approved by: https://github.com/albanD, https://github.com/malfet
2023-05-02 18:20:32 +00:00
7d2f1cd211 Fix typos under docs directory (#88033)
This PR fixes typos in `.rst` and `.Doxyfile` files under docs directory

Pull Request resolved: https://github.com/pytorch/pytorch/pull/88033
Approved by: https://github.com/soulitzer
2022-10-31 19:31:56 +00:00
72ec1b5fc1 Fix typo under docs directory (#87583)
This PR fixes typo in `.rst` files under docs directory

Pull Request resolved: https://github.com/pytorch/pytorch/pull/87583
Approved by: https://github.com/kit1980
2022-10-24 23:52:44 +00:00
bc57306bdd Fix typo under docs directory and RELEASE.md (#85896)
This PR fixes typo in rst files under docs directory and `RELEASE.md`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/85896
Approved by: https://github.com/kit1980
2022-09-29 21:41:59 +00:00
e7635c06ce Fix typos in docs (#80602)
I hope it helps.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80602
Approved by: https://github.com/kit1980
2022-08-29 23:32:44 +00:00
8573da59c3 Re-enable C++ doc generation (#81719)
Reverts #80451, as this caused problems reported by many internal and external users. The generated C++ docs are used, even if they are lacking in human-generated content.

Fixes #80505
Pull Request resolved: https://github.com/pytorch/pytorch/pull/81719
Approved by: https://github.com/kit1980, https://github.com/albanD
2022-07-20 19:54:47 +00:00
f70bf13c6e Disable doxygen / breathe / exhale generation of C++ API docs (#80451)
Fixes #79992

This PR:
* Removes doxygen / breathe / exhale configuration from the Sphinx config in `source/conf.py` so it no longer runs
* Maintains the human-generated content describing API usage in the various .rst files
    * Exception: `library.rst` is removed, as its main purpose is linking to API docs
* Removes all links to the generated API docs from the human-generated content

The build is nearly instantaneous now and should be much less memory intensive as well.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/80451
Approved by: https://github.com/suo
2022-06-28 17:56:41 +00:00
02e35ce17b [ONNX] Update onnx function export with comments and clean up (#66817) (#67803)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/67803

* Addresses comments from #63589

[ONNX] remove torch::onnx::PRODUCER_VERSION (#67107)

Use constants from version.h instead.
This simplifies things since we no longer have to update
PRODUCER_VERSION for each release.

Also add TORCH_VERSION to version.h so that a string is available for
this purpose.

[ONNX] Set `ir_version` based on opset_version. (#67128)

This increases the odds that the exported ONNX model will be usable.
Before this change, we were setting the IR version to a value which may
be higher than what the model consumer supports.

Also some minor clean-up in the test code:
* Fix string replacement.
* Use a temporary file so as to not leave files around in the test
  current working directory.

Test Plan: Imported from OSS

Reviewed By: msaroufim

Differential Revision: D32181306

Pulled By: malfet

fbshipit-source-id: 02f136d34ef8f664ade0bc1985a584f0e8c2b663

Co-authored-by: BowenBao <bowbao@microsoft.com>
Co-authored-by: Gary Miguel <garymiguel@microsoft.com>
Co-authored-by: Nikita Shulga <nshulga@fb.com>
2021-11-05 10:35:35 -07:00
11fbd3958c MaybeOwned page for dev wiki (#63450)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63450

Brief guide to understanding `MaybeOwned<Tensor>`, aimed at C++ PT devs who are obliged to interact with existing uses of it, rather than encouraging new usage.

For reviewers: I haven't yet added a link to this page from anywhere. I'm thinking the right place is the [dev wiki main page C++ section](https://github.com/pytorch/pytorch/wiki#c) but happy to put it wherever makes sense, suggestions welcome.

Test Plan: Imported from OSS

Reviewed By: navahgar

Differential Revision: D30402313

Pulled By: bhosmer

fbshipit-source-id: 69b15909ecafcd8d88e44f664f88c3ad4eb26d84
2021-08-18 12:08:58 -07:00
329426c249 Fix cppdoc example syntax (#62385)
Summary:
a simple fix

Pull Request resolved: https://github.com/pytorch/pytorch/pull/62385

Reviewed By: suo

Differential Revision: D30000982

Pulled By: heitorschueroff

fbshipit-source-id: e2e1c9efba3734b58d9b5f358c01d12c2c8c91ff
2021-07-30 04:36:55 -07:00
a7a5992d7d Add no-grad inference mode note (#58513)
Summary:
Adds a note explaining the difference between several often conflated mechanisms in the autograd note
Also adds a link to this note from the docs in `grad_mode` and `nn.module`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58513

Reviewed By: gchanan

Differential Revision: D28651129

Pulled By: soulitzer

fbshipit-source-id: af9eb1749b641fc1b632815634eea36bf7979156
2021-05-25 13:06:54 -07:00
74a4868d9a Add docs for c10::InferenceMode. (#57480)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/57480

Test Plan: Imported from OSS

Reviewed By: navahgar, pbelevich

Differential Revision: D28164070

Pulled By: ailzhang

fbshipit-source-id: a6b0658f3e65f76387095fbd8d66c762914d3bea
2021-05-03 19:36:10 -07:00
12a61a172e Fix missing class in cpp tensor documentation (#54488)
Summary:
The given example in the documentation does not compile due to the missing `torch::`. It is correct in the tutorial about [writing a custom extension ](https://pytorch.org/tutorials/advanced/cpp_extension.html#writing-a-mixed-c-cuda-extension)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54488

Reviewed By: bdhirsh

Differential Revision: D27267000

Pulled By: glaringlee

fbshipit-source-id: 86a46d656c1a4fa4098287a6a43a38d1ef80171e
2021-03-24 11:10:19 -07:00
8c798e0622 Forbid trailing whitespace (#53406)
Summary:
Context: https://github.com/pytorch/pytorch/pull/53299#discussion_r587882857

These are the only hand-written parts of this diff:
- the addition to `.github/workflows/lint.yml`
- the file endings changed in these four files (to appease FB-internal land-blocking lints):
  - `GLOSSARY.md`
  - `aten/src/ATen/core/op_registration/README.md`
  - `scripts/README.md`
  - `torch/csrc/jit/codegen/fuser/README.md`

The rest was generated by running this command (on macOS):
```
git grep -I -l ' $' -- . ':(exclude)**/contrib/**' ':(exclude)third_party' | xargs gsed -i 's/ *$//'
```

I looked over the auto-generated changes and didn't see anything that looked problematic.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53406

Test Plan:
This run (after adding the lint but before removing existing trailing spaces) failed:
- https://github.com/pytorch/pytorch/runs/2043032377

This run (on the tip of this PR) succeeded:
- https://github.com/pytorch/pytorch/runs/2043296348

Reviewed By: walterddr, seemethere

Differential Revision: D26856620

Pulled By: samestep

fbshipit-source-id: 3f0de7f7c2e4b0f1c089eac9b5085a58dd7e0d97
2021-03-05 17:22:55 -08:00
e60f18c2ad Generate header with version #defines for LibTorch (#50073)
Summary:
Uses cmake's `configure_file()` macro to generate a new `torch/csrc/api/include/torch/version.h` header with `TORCH_VERSION_{MAJOR,MINOR,PATCH}` \#defines from an input file `torch/csrc/api/include/torch/version.h.in`.

For Bazel builds, this is accomplished with `header_template_rule()`.

For Buck builds, this is accomplished with `fb_native.genrule()`.

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

<img width="1229" alt="Screen Shot 2021-01-05 at 3 19 24 PM" src="https://user-images.githubusercontent.com/75754324/103809279-3fd80380-5027-11eb-9039-fd23922cebd5.png">

Pull Request resolved: https://github.com/pytorch/pytorch/pull/50073

Reviewed By: glaringlee

Differential Revision: D25855877

Pulled By: jbschlosser

fbshipit-source-id: 6bb792718c97e2c2dbaa74b7b7b831a4f6938e49
2021-02-03 22:18:53 -08:00
3858aaab37 Fix syntax issue in c++ cuda api note (#48434)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/48434

Test Plan: Imported from OSS

Reviewed By: rohan-varma

Differential Revision: D25173692

Pulled By: glaringlee

fbshipit-source-id: bbd6fa7615200bf1eaea731a4ed251d423412593
2020-11-25 14:31:14 -08:00
255b0e839f C++ APIs CUDA Stream Note (Set/Get part) (#45754)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/45754

Test Plan: Imported from OSS

Reviewed By: albanD

Differential Revision: D24085103

Pulled By: glaringlee

fbshipit-source-id: c9641c2baadcf93b84733c037ce91b670dde5f96
2020-10-06 14:57:16 -07:00
86f3305859 Improve C++ API autograd and indexing docs (#35777)
Summary:
This PR adds docs for the following components:
1. Tensor autograd APIs (such as `is_leaf` / `backward` / `detach` / `detach_` / `retain_grad` / `grad` / `register_hook` / `remove_hook`)
2. Autograd APIs: `torch::autograd::backward` / `grad` / `Function` / `AutogradContext`, `torch::NoGradGuard` / `torch::AutoGradMode`
3. Tensor indexing
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35777

Differential Revision: D20810616

Pulled By: yf225

fbshipit-source-id: 60526ec0c5b051021901d89bc3b56861c68758e8
2020-04-02 09:33:11 -07:00
b33ae23c5a Revert D20794765: [pytorch][PR] Improve C++ API autograd and indexing docs
Test Plan: revert-hammer

Differential Revision:
D20794765

Original commit changeset: fad623e5d505

fbshipit-source-id: 041fb7257d4978a3767d8229d70d6f3cc55e5f28
2020-04-01 20:14:13 -07:00
41ef2c0d58 Improve C++ API autograd and indexing docs (#35777)
Summary:
This PR adds docs for the following components:
1. Tensor autograd APIs (such as `is_leaf` / `backward` / `detach` / `detach_` / `retain_grad` / `grad` / `register_hook` / `remove_hook`)
2. Autograd APIs: `torch::autograd::backward` / `grad` / `Function` / `AutogradContext`, `torch::NoGradGuard` / `torch::AutoGradMode`
3. Tensor indexing
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35777

Differential Revision: D20794765

Pulled By: yf225

fbshipit-source-id: fad623e5d505b7cfcd76a8c5264f18b7a0a3298c
2020-04-01 16:54:08 -07:00
a201027e93 Abstract atomic add calls (#31992)
Summary:
Instead of a mixture of direct calls to library provided atomicAdd calls, such as float atomicAdd(float*, float) and calls provided internally, such as void atomicAdd(long*, long), abstract to one API void gpuAtomicAdd(T*, T) in THCAtomics.cuh for the PyTorch backend.

The advantage of this approach is that it allows us to more easily distinguish between capabiltiies of different platforms (and their versions). Additionally, the abstraction of void returning atomicAdds allows us to, in the future, support fast HW instructions on some platforms that will not return the previous value.

Call sites that do not satisfy above conditions and are either highly platform specific (__half2 atomicAdd fast path in one operator) or require the return explicitly (some int atomicAdd invocations) are left untouched. The Caffe2 backend also remains untouched.

While here, add a bunch of includes of THCAtomics.cuh that were missing before.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31992

Differential Revision: D19330220

Pulled By: ezyang

fbshipit-source-id: d6ab73ec5168c77e328faeef6c6f48eefba00861
2020-01-10 09:48:42 -08:00
5554e5b793 Docs: c++11 -> c++14 (#30530)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/30530

Switch some mentions of "C++11" in the docs to "C++14"
ghstack-source-id: 95812049

Test Plan: testinprod

Differential Revision: D18733733

fbshipit-source-id: b9d0490eb3f72bad974d134bbe9eb563f6bc8775
2019-12-17 14:09:02 -08:00
11172c19be codemod at::ArrayRef and torch::IntArrayRef to std::vector in C++ API tests (#27884)
Summary:
`at::ArrayRef` / `torch::IntArrayRef` should be discouraged in user code, because users might not be aware of the fact that it doesn't own the underlying data, which already leads to memory access bugs when they try to write the following:
```cpp
auto expected_sizes = torch::IntArrayRef({2, 16, 6});  // The memory that represents `{2, 16, 6}` is released after this line
ASSERT_EQ(output.sizes(), expected_sizes);  // `expected_sizes` is pointing to invalid memory region
```
This PR changes all usage of `at::ArrayRef` and `torch::IntArrayRef` to the corresponding `std::vector` version, so that users won't pick up the habit of using `ArrayRef` by looking at the test code.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/27884

Differential Revision: D17921646

Pulled By: yf225

fbshipit-source-id: 461e79fc22b598aac230d36cc028085ce6cbe937
2019-10-14 18:00:30 -07:00
76ee02f10d Rename packed tensor accessor (#25654)
Summary:
Closes https://github.com/pytorch/pytorch/issues/19268

This does the renaming suggested by ezyang in https://github.com/pytorch/pytorch/issues/19268#issuecomment-490478887 except that the templated version of `packed_accessor` is also renamed to `generic_packed_accessor`.

Additionally, all of the users I could find in `ATen/native/cuda` are updated without changing their index types.

The corresponding tutorial update is in pytorch/tutorials#644
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25654

Differential Revision: D17259208

Pulled By: ezyang

fbshipit-source-id: 172a46f623d544ca16f7ed5077b6e4f57a3d1f21
2019-09-10 09:18:54 -07:00
0015b188be Fix typos
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/23770

Differential Revision: D16646852

Pulled By: ezyang

fbshipit-source-id: 826b041c0b528ae6e0b320d49d8141057c1f9bf3
2019-08-05 15:38:32 -07:00
0676ba0c5c Mention packed accessors in tensor basics doc (#19464)
Summary:
This is a continuation of efforts into packed accessor awareness.
A very simple example is added, along with the mention that the template can hold more arguments.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/19464

Differential Revision: D15012564

Pulled By: soumith

fbshipit-source-id: a19ed536e016fae519b062d847cc58aef01b1b92
2019-04-19 07:20:16 -07:00
48a35135fb Convert all tabs to spaces, add CI. (#18959)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18959
ghimport-source-id: a934163fa34cb2019732d5f49dc7290c376bf156

Differential Revision: D14831246

Pulled By: ezyang

fbshipit-source-id: beb92dc4ee8c82f4c8259c081dd72e477fe7a9d0
2019-04-09 08:12:26 -07:00
674c274d92 Change deprecated IntList to IntArrayRef
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18262

Differential Revision: D14612244

Pulled By: ezyang

fbshipit-source-id: 5d21c7b94d64104fececcb15c6d38d9bd2a1fc70
2019-03-25 19:47:21 -07:00
dfcafb1f71 cpp doc fix (#16221)
Summary:
Fixed a few C++ API callsites to work with v1.0.1.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/16221

Differential Revision: D13759207

Pulled By: yf225

fbshipit-source-id: bd92c2b95a0c6ff3ba5d73cb249d0bc88cfdc340
2019-01-21 21:56:22 -08:00
321a559359 Fix restructured text issue in tensor_basics.rst (#15701)
Summary:
Fix submitted by huntzhan in https://github.com/pytorch/cppdocs/pull/4. The source is in this repo so the patch has to be applied here.

soumith ezyang
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15701

Differential Revision: D13591302

Pulled By: goldsborough

fbshipit-source-id: 796957696fd560a9c5fb42265d7b2d018abaebe3
2019-01-07 11:35:19 -08:00
49fe678fec Add variable_factories.h to cppdocs (#14381)
Summary:
This will document `torch::from_blob` and such.

soumith ezyang
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14381

Differential Revision: D13216560

Pulled By: goldsborough

fbshipit-source-id: 112f60e45e4d38a8a9983fa71e9cc56bc1a73465
2018-11-27 10:13:23 -08:00
e2272dd312 Remove ATen/README.md in favor of cppdocs/notes/tensor_basics.rst (#13601)
Summary:
Removes aten/README.md (and some other files dating from when aten was its own repo), and moves the not outdated documentation into a note called "Tensor Basics". I updated the text lightly but did not overhaul the content.

CC zdevito

ezyang
Pull Request resolved: https://github.com/pytorch/pytorch/pull/13601

Differential Revision: D12934480

Pulled By: goldsborough

fbshipit-source-id: 012a4267b4d6f27e4d5d55d6fc66363ddca10b41
2018-11-05 19:13:50 -08:00
84cfc28f23 Note on Tensor Creation
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13517

Differential Revision: D12914271

Pulled By: goldsborough

fbshipit-source-id: df64fca6652525bc814f6fd3e486c87bff29b5b5
2018-11-05 16:10:58 -08:00