pytorch/docs/source
Eli Uriegas e5fcc903d6 torch: Make __version__ better with comparisons (#61556)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61556

Prior to 1.10.0 `torch.__version__` was stored as a str and so many did
comparisons against `torch.__version__` as if it were a str. In order to not
break them we have TorchVersion which masquerades as a str while also
having the ability to compare against both packaging.version.Version as
well as tuples of values, eg. (1, 2, 1)

Examples:
  Comparing a TorchVersion object to a Version object
```
TorchVersion('1.10.0a') > Version('1.10.0a')
```
  Comparing a TorchVersion object to a Tuple object
```
TorchVersion('1.10.0a') > (1, 2)    # 1.2
TorchVersion('1.10.0a') > (1, 2, 1) # 1.2.1
```

  Comparing a TorchVersion object against a string
```
TorchVersion('1.10.0a') > '1.2'
TorchVersion('1.10.0a') > '1.2.1'
```

Resolves https://github.com/pytorch/pytorch/issues/61540

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>

Test Plan: Imported from OSS

Reviewed By: zou3519

Differential Revision: D29671234

Pulled By: seemethere

fbshipit-source-id: 6044805918723b4aca60bbec4b5aafc1189eaad7
2021-07-15 15:12:09 -07:00
..
_static DOC Improve documentation for LayerNorm (#59178) 2021-06-07 14:34:10 -07:00
_templates Remove master documentation from being indexable by search engines (#58056) 2021-05-18 06:20:09 -07:00
community
elastic [torch] Various improvements to torch.distributed.launch and torch.distributed.run (#61294) 2021-07-08 16:28:06 -07:00
notes clarify default value of requires_grad for tensors (#61038) 2021-07-12 12:57:37 -07:00
rpc
scripts Add mish activation function (#58648) 2021-05-25 10:36:21 -07:00
__config__.rst
amp.rst Moves grid_sampler to autocast promote list (#58618) 2021-06-21 10:22:36 -07:00
autograd.rst Add no-grad inference mode note (#58513) 2021-05-25 13:06:54 -07:00
backends.rst
benchmark_utils.rst
bottleneck.rst
checkpoint.rst
complex_numbers.rst Grammatical update of tech docs (#61547) 2021-07-14 14:01:59 -07:00
conf.py torch: Make __version__ better with comparisons (#61556) 2021-07-15 15:12:09 -07:00
cpp_extension.rst
cpp_index.rst
cuda.rst
cudnn_persistent_rnn.rst
cudnn_rnn_determinism.rst
data.rst [DataLoader][doc] Randomness for base_seed generator and NumPy seed (#56528) 2021-04-22 09:40:45 -07:00
ddp_comm_hooks.rst [Gradient Compression] Remove unnecessary warning on the rst file and the check on C++ version (#58170) 2021-05-12 14:15:10 -07:00
distributed.elastic.rst [1/n][torch/elastic] Move torchelastic docs *.rst (#148) 2021-05-04 00:57:56 -07:00
distributed.optim.rst
distributed.rst Add compare_set in distributed docs (#61351) 2021-07-08 12:30:32 -07:00
distributions.rst
dlpack.rst
docutils.conf
fft.rst
futures.rst Update docs to mention CUDA support for Future (#50048) 2021-05-11 08:26:33 -07:00
fx.rst [FX][docs] Add note about python set pitfall (#61597) 2021-07-13 20:09:13 -07:00
hub.rst
index.rst add torch.testing to docs (#57247) 2021-05-07 09:16:39 -07:00
jit.rst
jit_builtin_functions.rst
jit_language_reference.rst
jit_language_reference_v2.rst Fix hasattr support type (#57950) 2021-05-10 12:21:56 -07:00
jit_python_reference.rst [JIT] improve documentation (#57991) 2021-05-19 11:47:32 -07:00
jit_unsupported.rst
linalg.rst Add torch.linalg.inv_ex without checking for errors by default (#58039) 2021-05-13 09:42:15 -07:00
math-quantizer-equation.png
mobile_optimizer.rst
model_zoo.rst
multiprocessing.rst
name_inference.rst Abladawood patch 1 (#58496) 2021-05-20 10:32:18 -07:00
named_tensor.rst
nn.functional.rst Add mish activation function (#58648) 2021-05-25 10:36:21 -07:00
nn.init.rst
nn.rst Added GLU and FeatureAlphaDropout to nn docs (#60590) 2021-06-24 08:00:18 -07:00
onnx.rst [ONNX] Update documentation (#58712) (#60249) 2021-07-08 16:29:32 -07:00
optim.rst To add Rectified Adam Algorithm to Optimizers (#58968) 2021-06-23 18:27:57 -07:00
package.rst [package] PackageExporter remove verbose mode (#61145) 2021-07-08 18:26:43 -07:00
pipeline.rst
profiler.rst
quantization-support.rst
quantization.rst quantization: improve documentation on natively supported backends (#58925) 2021-06-07 17:29:03 -07:00
random.rst
rpc.rst Add a disclaimer about limited CUDA support in RPC (#58023) 2021-05-12 00:11:22 -07:00
sparse.rst
special.rst [special] migrate log_softmax (#60512) 2021-07-12 11:01:25 -07:00
storage.rst
tensor_attributes.rst
tensor_view.rst Conjugate View (#54987) 2021-06-04 14:12:41 -07:00
tensorboard.rst
tensors.rst Add neg bit (#56058) 2021-07-13 13:50:42 -07:00
testing.rst add torch.testing to docs (#57247) 2021-05-07 09:16:39 -07:00
torch.nn.intrinsic.qat.rst
torch.nn.intrinsic.quantized.rst
torch.nn.intrinsic.rst
torch.nn.qat.rst
torch.nn.quantized.dynamic.rst
torch.nn.quantized.rst
torch.overrides.rst
torch.quantization.rst
torch.rst Add neg bit (#56058) 2021-07-13 13:50:42 -07:00
type_info.rst