pytorch/torch
Alexander Novikov 0971637c11 Fix torch.tensor warning in ONNX symbolic_opset10 export (#158835)
Fix PyTorch tensor copying warning in ONNX export

## Problem

PyTorch ONNX exporter was generating a warning about incorrect tensor copying method:

```
UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/158835
Approved by: https://github.com/justinchuby
2025-07-22 16:32:49 +00:00
..
_awaits
_C Revert "Add unified memory APIs for torch.accelerator (#152932)" 2025-07-22 01:01:41 +00:00
_C_flatbuffer
_custom_op
_decomp Revert "Fused RMSNorm implementation (#153666)" 2025-07-21 17:31:42 +00:00
_dispatch Improve torch.ops typing (#154555) 2025-06-22 15:52:27 +00:00
_dynamo Still run TritonBundler with BundledAOTAutogradCache, save autotune results (#158048) 2025-07-22 14:12:21 +00:00
_export Add FP8 Types (#158430) 2025-07-17 18:09:56 +00:00
_functorch De-abstract premature generalization with InductorWrapper (#158528) 2025-07-21 13:27:07 +00:00
_higher_order_ops [hop] set capture_scalar_outputs=True by default for compiled hops (#158480) 2025-07-18 07:16:50 +00:00
_inductor Revert "[AOTI] Add more default options to compile_standalone (#158560)" 2025-07-22 16:20:17 +00:00
_lazy [BE][2/16] fix typos in torch/ (torch/_*/) (#156312) 2025-07-12 05:47:06 +00:00
_library Revert "[BE] remove torch deploy - conditionals (#158288)" 2025-07-21 23:17:39 +00:00
_logging [dynamo][be] hide warnings without invalidating warnings cache (#158520) 2025-07-18 22:02:31 +00:00
_numpy Fix torch._numpy to match NumPy when empty ellipsis causes advanced indexing separation (#158297) 2025-07-16 08:11:53 +00:00
_prims [BE][2/16] fix typos in torch/ (torch/_*/) (#156312) 2025-07-12 05:47:06 +00:00
_prims_common [BE][2/16] fix typos in torch/ (torch/_*/) (#156312) 2025-07-12 05:47:06 +00:00
_refs [BE][2/16] fix typos in torch/ (torch/_*/) (#156312) 2025-07-12 05:47:06 +00:00
_strobelight [BE][2/16] fix typos in torch/ (torch/_*/) (#156312) 2025-07-12 05:47:06 +00:00
_subclasses Revert "removed zero dim cpu logic from fake_tensor.py (#147501)" 2025-07-22 15:45:34 +00:00
_vendor
accelerator Revert "Add unified memory APIs for torch.accelerator (#152932)" 2025-07-22 01:01:41 +00:00
amp Issue warning with reference to user code rather than torch (#155112) 2025-07-14 05:24:23 +00:00
ao Use new type statement to fix public API of types (#158487) 2025-07-17 18:46:44 +00:00
autograd Fix types in graphs.py (#158192) 2025-07-15 19:49:38 +00:00
backends Expose opt_einsum in torch.backends (#157740) 2025-07-15 17:46:43 +00:00
compiler Revert "Add torch compile force disable caches alias (#158072)" 2025-07-18 04:58:24 +00:00
contrib
cpu
csrc [AOTI] Convert C-struct zip handling to RAII container (#158687) 2025-07-22 16:01:51 +00:00
cuda Revert "Add unified memory APIs for torch.accelerator (#152932)" 2025-07-22 01:01:41 +00:00
distributed Fix clamp(min/max) strategy (#158619) 2025-07-21 23:26:08 +00:00
distributions [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
export [AOTI] fix load_pt2 split wrong model name on Windows (#158711) 2025-07-22 01:54:44 +00:00
fft [BE][PYFMT] migrate PYFMT for torch/[e-n]*/ to ruff format (#144553) 2025-06-17 08:18:47 +00:00
func
futures Simplify the base classes of _PyFutureMeta (#157757) 2025-07-08 15:39:56 +00:00
fx Change from import trace to import config (#158796) 2025-07-22 06:10:38 +00:00
headeronly Add STD_TORCH_CHECK to headeronly (#158377) 2025-07-18 14:35:20 +00:00
jit [4/n] Remove references to TorchScript in PyTorch docs (#158317) 2025-07-16 20:01:34 +00:00
legacy
lib [2/N] Fix cppcoreguidelines-init-variables suppression (#146237) 2025-06-19 23:26:42 +00:00
linalg
masked Fix MaskedTensor to device ignored mask (#151205) 2025-07-21 21:44:49 +00:00
monitor
mps [BE][12/16] fix typos in torch/ (#156602) 2025-07-02 22:55:29 +00:00
mtia [BE][PYFMT] migrate PYFMT for torch/[e-n]*/ to ruff format (#144553) 2025-06-17 08:18:47 +00:00
multiprocessing [BE][12/16] fix typos in torch/ (#156602) 2025-07-02 22:55:29 +00:00
nativert [BE] Fix extra-semi warnings (#158730) 2025-07-22 01:05:03 +00:00
nested Add check nested_tensor_from_jagged param jagged_dim >= 1 (#157770) 2025-07-10 00:34:39 +00:00
nn Add a way to disable compile for debugging flex-attention (#158534) 2025-07-18 05:33:45 +00:00
onnx Fix torch.tensor warning in ONNX symbolic_opset10 export (#158835) 2025-07-22 16:32:49 +00:00
optim Document the rest of the specific optimizer module APIs (#158669) 2025-07-19 07:27:15 +00:00
package [BE][Ez]: Update ruff to 0.12.2 (#157937) 2025-07-11 15:16:20 +00:00
profiler [BE][Ez]: Autotype torch/profiler with ruff ANN (#157923) 2025-07-09 22:07:50 +00:00
quantization [BE][6/16] fix typos in torch/ (#156316) 2025-06-23 02:57:34 +00:00
signal [BE][6/16] fix typos in torch/ (#156316) 2025-06-23 02:57:34 +00:00
sparse [build] modernize build-frontend: python setup.py develop/install -> [uv ]pip install --no-build-isolation [-e ]. (#156027) 2025-07-09 11:24:27 +00:00
special [BE][6/16] fix typos in torch/ (#156316) 2025-06-23 02:57:34 +00:00
testing [BE] Raise ValueError from torch.cat meta func (#158249) 2025-07-20 23:49:18 +00:00
utils Revert "[BE] remove torch deploy - conditionals (#158288)" 2025-07-21 23:17:39 +00:00
xpu [BE][6/16] fix typos in torch/ (#156316) 2025-06-23 02:57:34 +00:00
__config__.py
__future__.py
__init__.py Revert "[BE] remove torch deploy - conditionals (#158288)" 2025-07-21 23:17:39 +00:00
_appdirs.py
_classes.py remove allow-untyped-defs from torch/_classes.py (#157231) 2025-07-08 00:11:52 +00:00
_compile.py
_custom_ops.py
_deploy.py Revert "[BE] Remove torch deploy | remove torch deploy specific files (#158290)" 2025-07-21 23:17:39 +00:00
_environment.py
_guards.py [dynamo][fsdp] Consistent behavior of int attributes (#157262) 2025-07-22 11:26:54 +00:00
_jit_internal.py [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
_linalg_utils.py Update is_sparse doc to mention that it is sparse_coo specific (#157378) 2025-07-09 18:22:14 +00:00
_lobpcg.py [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
_lowrank.py [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
_meta_registrations.py Revert "DDE-Free select with unbacked index. (#157605)" 2025-07-17 16:20:02 +00:00
_namedtensor_internals.py
_ops.py Revert "[BE] remove torch deploy - conditionals (#158288)" 2025-07-21 23:17:39 +00:00
_python_dispatcher.py
_size_docs.py
_sources.py
_storage_docs.py
_streambase.py
_tensor_docs.py Documentation Fix: torch.tensor.scatter_ docs (#157929) 2025-07-10 19:22:52 +00:00
_tensor_str.py
_tensor.py Raise BufferError for DLPack buffer-related errors. (#150691) 2025-07-20 00:46:21 +00:00
_thread_safe_fork.py
_torch_docs.py Fix torch.randint, torch.mul param missing description (#158731) 2025-07-21 20:17:27 +00:00
_utils_internal.py Revert "[BE] remove torch deploy - conditionals (#158288)" 2025-07-21 23:17:39 +00:00
_utils.py [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
_VF.py
_vmap_internals.py
_weights_only_unpickler.py
CMakeLists.txt Migrate c10/macros/cmake_macros.h.in to torch/headeronly (#158035) 2025-07-15 19:52:59 +00:00
custom_class_detail.h
custom_class.h [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
extension.h
functional.py [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
header_only_apis.txt Add STD_TORCH_CHECK to headeronly (#158377) 2025-07-18 14:35:20 +00:00
hub.py [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
library.h [BE][1/16] fix typos in torch/ (#156311) 2025-07-09 11:02:22 +00:00
library.py Revert "[BE] remove torch deploy - conditionals (#158288)" 2025-07-21 23:17:39 +00:00
overrides.py Revert "Fused RMSNorm implementation (#153666)" 2025-07-21 17:31:42 +00:00
py.typed
quasirandom.py
random.py
return_types.py
script.h
serialization.py Reduce random reads for offset metadata when calling torch.load under FakeTensorMode (#157931) 2025-07-17 22:17:52 +00:00
storage.py mypy 1.16.0 (#155821) 2025-06-14 18:18:43 +00:00
torch_version.py
types.py
version.py.tpl