pytorch/torch
Pian Pawakapan f0a92541fe [export] fix lifted constants order for 0-input graphs (#136658)
Summary:
With empty graphs, the `graph.inserting_before(first_user_input = None)` call turns into a `graph.inserting_after(root)` call, inverting the order of constant input nodes being inserted.

This fixes the issue by initializing to the first node in the graph (still valid if not a user input - only used for insertion).

Test Plan: test_export

Differential Revision: D63403514

Pull Request resolved: https://github.com/pytorch/pytorch/pull/136658
Approved by: https://github.com/avikchaudhuri
2024-09-26 17:44:24 +00:00
..
_awaits
_C Revert "[Dynamo] Trace enter/exit of TorchFunctionModes (#135422)" (#136590) 2024-09-25 21:10:43 +00:00
_C_flatbuffer
_custom_op
_decomp [aotd] Fix rrelu compilation (#136008) 2024-09-25 11:26:19 +00:00
_dispatch
_dynamo Correctly convert Python float to float64 when passing argument as Tensor (#136413) 2024-09-26 16:50:13 +00:00
_export [export] fix lifted constants order for 0-input graphs (#136658) 2024-09-26 17:44:24 +00:00
_functorch [aotd] Fix freezing API for subclasses (#136265) 2024-09-24 13:15:01 +00:00
_higher_order_ops [user-written triton kernels] specialize exprs if they are expected to be tl.constexpr (#136512) 2024-09-25 17:12:11 +00:00
_inductor [AOTI][Tooling][9/n] Add debug printer support for cpp kernel type (#136465) 2024-09-26 17:30:43 +00:00
_lazy
_library Improve data-dependent-output meta kernel error message (#136671) 2024-09-26 03:46:04 +00:00
_logging Don't actually import module when checking if its valid (#136548) 2024-09-25 20:47:32 +00:00
_numpy
_prims Remove aten.item hack (#136663) 2024-09-26 17:14:48 +00:00
_prims_common
_refs Remove prims.slice_in_dim and prims.slice (#136150) 2024-09-23 01:27:22 +00:00
_strobelight [Pytorch] Cleanup Strobelight URL and shorten for readability (#136102) 2024-09-16 18:10:33 +00:00
_subclasses Fix bug in functional tensor decomp (#136600) 2024-09-25 17:37:50 +00:00
_vendor
amp
ao [Quant][PT2E]change flatten recipe for X86InductorQuantizer (#136298) 2024-09-24 04:30:12 +00:00
autograd Param fixes in docstring (#136097) 2024-09-21 18:56:34 +00:00
backends Add option to configure reduced precision math backend for SDPA (#135964) 2024-09-24 07:11:38 +00:00
compiler
contrib
cpu
csrc [3/N] Fix clang-tidy warnings in torch/csrc/lazy (#136705) 2024-09-26 16:29:43 +00:00
cuda Update get_device_properties to take in optional device (#136683) 2024-09-26 15:07:31 +00:00
distributed [reland] [torchelastic][c10d] Fix store prefix race in rendezvous (#136768) 2024-09-26 17:37:07 +00:00
distributions [BE]: Update mypy to 1.11.2 (#133816) 2024-09-16 19:44:11 +00:00
export Remove aten.item hack (#136663) 2024-09-26 17:14:48 +00:00
fft
func
futures
fx [FX] Update _inline_module util function to work with both args and kwargs (#136631) 2024-09-25 20:20:57 +00:00
jit
legacy
lib
linalg
masked [BE]: Update mypy to 1.11.2 (#133816) 2024-09-16 19:44:11 +00:00
monitor
mps
mtia [MTIA] Support torch.cuda.get_device_capability equivalent API on MTIA (#135889) 2024-09-17 17:42:56 +00:00
multiprocessing [torch/multiprocessing] Use multiprocessing.reduction.register ForkingPickler.register to register custom tensor and storage reductions (#135030) 2024-09-16 20:07:29 +00:00
nested Fix composite op redispatch for NJT in inference mode (#134683) 2024-09-26 14:10:53 +00:00
nn [FlexAttention] Add Better error message for cpu tensors (#136673) 2024-09-26 16:40:21 +00:00
onnx [ONNX] Remove _optimize_graph from public init (#136279) 2024-09-24 22:00:55 +00:00
optim Add missing input "eps" to adam docs (#135191) 2024-09-25 20:17:23 +00:00
package [3.13] fix 3.13 pickle error in torch/package (#136049) 2024-09-14 14:28:09 +00:00
profiler [Profiler] Torch Profiler distributed info is not JSON serializable (#135548) 2024-09-13 02:22:33 +00:00
quantization
signal
sparse Tune bsr_dense_addmm for int8 inputs on A100 (#136088) 2024-09-25 00:24:12 +00:00
special
testing [FlexAttention] Add Better error message for cpu tensors (#136673) 2024-09-26 16:40:21 +00:00
utils Add Triton CPU as an Inductor backend (#133408) 2024-09-26 15:35:26 +00:00
xpu [Inductor] Fix Triton tests after updating pybind11 to 2.13.6 (#136280) 2024-09-25 08:09:46 +00:00
__config__.py
__future__.py
__init__.py Correctly convert Python float to float64 when passing argument as Tensor (#136413) 2024-09-26 16:50:13 +00:00
_appdirs.py
_classes.py
_compile.py
_custom_ops.py
_deploy.py
_guards.py [aotd] Fix freezing API for subclasses (#136265) 2024-09-24 13:15:01 +00:00
_jit_internal.py
_linalg_utils.py
_lobpcg.py
_lowrank.py
_meta_registrations.py Add decomps for max_unpool (#133146) 2024-09-20 21:35:25 +00:00
_namedtensor_internals.py
_ops.py Allow fx graph caching higher order operators (opt-in) (#135877) 2024-09-24 17:23:09 +00:00
_python_dispatcher.py
_size_docs.py
_sources.py
_storage_docs.py
_streambase.py
_tensor.py Add deterministic path for CUDA cumsum (#136224) 2024-09-26 04:52:05 +00:00
_tensor_docs.py Add deterministic path for CUDA cumsum (#136224) 2024-09-26 04:52:05 +00:00
_tensor_str.py
_torch_docs.py Add deterministic path for CUDA cumsum (#136224) 2024-09-26 04:52:05 +00:00
_utils.py
_utils_internal.py Revert "[Pytorch] Consolidate Strobelight compile time profiler between OSS and fbcode (#135953)" 2024-09-15 05:32:38 +00:00
_VF.py
_vmap_internals.py
_weights_only_unpickler.py
abi-check.cpp
CMakeLists.txt
custom_class.h
custom_class_detail.h
extension.h
functional.py Add deterministic path for CUDA cumsum (#136224) 2024-09-26 04:52:05 +00:00
hub.py torch.hub: add get_dir/set_dir type hints (#134906) 2024-09-12 03:53:29 +00:00
library.h
library.py noop on torch.library APIs under torch::deploy (multipy) (#136645) 2024-09-26 02:34:34 +00:00
overrides.py Add deterministic path for CUDA cumsum (#136224) 2024-09-26 04:52:05 +00:00
py.typed
quasirandom.py
random.py
README.txt
return_types.py
script.h
serialization.py [3.13] fix 3.13 pickle error in serialization.py (#136034) 2024-09-14 00:02:40 +00:00
storage.py
torch_version.py
types.py
version.py.tpl

Note [TH abstraction violation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

TH/THC provide some hpp headers, which are proper C++ headers rather than
C headers.  These headers serve double duty as *internal implementation
detail* headers, whose contents should largely not be used by external
clients.

Ideally, we would not install these headers at all; instead, you should
use public functions (in headers like `THTensor.h`, NOT `THTensor.hpp`)
to manipulate these structs.  However, there are a few places
in torch/csrc where we violate this abstraction.  They are marked with
a pointer to this note.  Each of those sites will have to be refactored
when we refactor the guts of THTensor and related structures.