Update ml-frameworks#131
Open
renovate[bot] wants to merge 1 commit into
Open
Conversation
e000a30 to
06b362b
Compare
4a0352f to
5712155
Compare
5712155 to
c9a58fc
Compare
c9a58fc to
b0ccde2
Compare
b0ccde2 to
a95e2b2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==3.10.9→==3.11.0==2.4.4→==2.5.1==2.11.0→==2.13.0Release Notes
matplotlib/matplotlib (matplotlib)
v3.11.0Compare Source
numpy/numpy (numpy)
v2.5.1Compare Source
v2.5.0: (June 21, 2026)Compare Source
NumPy 2.5.0 Release Notes
Numpy 2.5.0 is a transitional release. It drops support for Python 3.11,
marking the end of distutils, and expires a large number of deprecations made
in the 2.0.x release. It also improves free threading and brings sorting into
compliance with the array-api standard with the addition of descending sorts.
There is also a fair amount of preparation for Python 3.15, which will be
supported starting with the first rc.
This release supports Python versions 3.12-3.14.
Highlights
See New Features below for other additions.
Deprecations
numpy.char.chararrayis deprecated. Use anndarraywith a string or bytes dtype instead.(gh-30605)
numpy.takenow correctly checks if the result can be cast to the providedout=outunder the same-kind rule. ADeprecationWarningis given nowwhen this check fails. Previously,
takeincorrectly checked ifoutcould be cast to the result (the wrong direction). This deprecation also
affects
compressand possibly other functions. (Future versions of NumPymay tighten the casting check further.)
(gh-30615)
The
numpy.char.[as]arrayfunctions are deprecated. Use annumpy.[as]arraywith a string or bytes dtype instead.(gh-30802)
Setting the dtype attribute is deprecated because mutating an array is unsafe
if an array is shared, especially by multiple threads. As an alternative,
you can create a view with a new dtype via
array.view(dtype=new_dtype).(gh-29244)
Setting the
shapeattribute is deprecated because mutating an array isunsafe if an array is shared, especially by multiple threads. As an
alternative, you can create a new view via
np.reshapeornp.ndarray.reshape. For example:x = np.arange(15); x = np.reshape(x, (3, 5)).To ensure no copy is made from the data, one can use
np.reshape(..., copy=False).While setting the shape on an array is discouraged, for cases where it is
difficult to work around, e.g., in
__array_finalize__, it is possiblewith the private method
np.ndarray._set_shape.(gh-29536)
Using the
genericunit innumpy.timedelta64is deprecated since thiscan lead to unexpected behavior such as non-transitive comparison, see
gh-28287 for details. As
an alternative, specify an explicit unit such as
's'(seconds) or'D'(days) when constructing
numpy.timedelta64. Due to this change, operationsthat implicitly rely on the
genericunit are also deprecated. Forexample:
1is implicitly converted to generic timedelta64(gh-29619)
Resizing a Numpy array in place is deprecated since mutating an array is
unsafe if an array is shared, especially by multiple threads. As an
alternative, you can create a resized array via
np.resize.(gh-30181)
numpy.fixis deprecated, usenumpy.truncinstead. It is faster andfollows the Array API standard. Both functions provide identical
functionality: rounding array elements towards zero.
(gh-30644)
numpy.ma.round_is deprecated.numpy.ma.roundcan be used as areplacement.
(gh-30738)
numpy.typenameis deprecated because the names returned by it wereoutdated and inconsistent.
numpy.dtype.namecan be used as areplacement.
(gh-30774)
Inputs other than integers are deprecated for
numpy.triu_indicesandnumpy.tril_indices. Non-integer values for theM,kandNparameters of
numpy.triare deprecated. Non-integer values for thekparameter of both
numpy.tril_indices_fromandnumpy.triu_indices_fromare deprecated.
(gh-30869)
Deprecations in custom
dtypeproperty and__array_finalize__.Previously
arr.view(dtype=new_dtype)calledarr.dtype = new_dtypealso for subclasses, i.e., the attribute setting. That path is now
deprecated and refined, meaning that even subclasses that do not see this
DeprecationWarningmay wish to update their code.A subclass that does any
dtypespecific logic (i.e. verifying the dtypein
__array_finalize__or has adtypeproperty) should now:_set_dtype = Nonein which casearr.view(dtype=new_dtype)will call
__array_finalize__with the new dtype, ensuring thatany validation
__array_finalize__will run is done._set_dtypeas a function (callingndarray._set_dtype()to avoidDeprecationWarnings.(Future versions might migrate towards the
_set_dtype = Nonepath.)Ideally, follow NumPy's deprecation to prevent
dtypemutation by users.The use of
ndarray._set_dtype()may be necessary for some subclassfinalization patterns, but should otherwise be avoided.
(gh-31293)
Expired deprecations
numpy.distutilshas been removed(gh-30340)
Passing
Noneas dtype tonp.finfowill now raise aTypeError(deprecated since 1.25)
(gh-30460)
numpy.crossno longer supports 2-dimensional vectors.(Deprecated since 2.0)
(gh-30461)
numpy._core.numerictypes.maximum_sctypehas been removed.(deprecated since 2.0)
(gh-30462)
numpy.row_stackhas been removed in favor ofnumpy.vstack.(deprecated since 2.0)
(gh-30463)
get_array_wraphas been removed.(deprecated since 2.0)
(gh-30463)
recfromtxtandrecfromcsvhave been removed fromnumpy.lib._npyioin favor of
numpy.genfromtxt.(deprecated since 2.0)
(gh-30467)
The
numpy.chararrayre-export ofnumpy.char.chararrayhas been removed.(deprecated since 2.0)
(gh-30604)
bincountnow raises aTypeErrorfor non-integer inputs.(deprecated since 2.1)
(gh-30610)
The
numpy.lib.mathalias for the standard librarymathmodule hasbeen removed.
(deprecated since 1.25)
(gh-30612)
Data type alias
'a'was removed in favor of'S'.(deprecated since 2.0)
(gh-30613)
_add_newdoc_ufunc(ufunc, newdoc)has been removed in favor ofufunc.__doc__ = newdoc.(deprecated since 2.2)
(gh-30614)
Compatibility notes
linalg.eigandlinalg.eigvalsnow always return complex arraysPreviously, the return values depended on whether the eigenvalues happen to lie
on the real line (which, for a general, non-symmetric matrix, is not
guaranteed).
This change makes consistent what was a value-dependent result. To retain the
previous behavior, do:
If your matrix is symmetrix/hermitian, use
eighandeigvalshinstead ofeigandeigvals. These are guaranteed to return real values. A commoncase is covariance matrices, which are symmetric and positive definite by
construction.
(gh-30411)
MSVC support
NumPy now requires minimum MSVC 19.35 toolchain version on Windows platforms.
This corresponds to Visual Studio 2022 version 17.5 Preview 2 or newer.
(gh-30489)
Cython support
NumPy's Cython headers (accessed via
cimport numpy) now require Cython 3.0or newer to build. If you try to compile a project that depends on NumPy's
Cython headers using Cython 0.29 or older, you will see a message like this:
versions.
See init.cython-30.pxd for the real Cython header
Note that the invalid integer is not a bug in NumPy - we are intentionally
generating this error to avoid triggering a more obscure error later in the
build when an older Cython version tries to use a Cython feature that was not
available in the old Cython version.
(gh-30770)
numpy.whereno longer truncates Python integersPreviously, if the
xoryargument ofnumpy.wherewas a Pythoninteger that was out of range of the output type, it would be silently
truncated. Now, an
OverflowErrorwill be raised instead.This change also applies to the underlying C API function
PyArray_Where.(gh-30803)
Default memory allocator change
NumPy now uses
PyMem_RawMallocandPyMem_RawFreeas the default memoryallocator, instead of system's
mallocandfreedirectly.(gh-30846)
from_dlpackraisesBufferErrorinstead ofRuntimeErrornp.from_dlpacknow raisesBufferErrorinstead ofRuntimeErrorwhenthe incoming DLPack tensor has an unsupported device, dtype, or exceeds the
maximum number of dimensions. This aligns with the DLPack and Array API
specifications, which recommend
BufferErrorfor data that cannot beimported.
(gh-30937)
Corrections to the BTPE binomial sampler
Two independent errors in the Stirling series of the acceptance/rejection step
of the BTPE algorithm used by
numpy.random.Generator.binomialhave beencorrected:
error was inherited from section 5.3 of the original 1988 paper by
Kachitvichyanukul & Schmeiser, which incorrectly adds all four terms.
13680instead of13860) that was introduced in the initial implementation.As a result,
Generator.binomialandGenerator.multinomial, which usesbinomial internally, may now return different samples for the same seed.
The legacy
numpy.random.RandomState.binomialandnumpy.random.RandomState.multinomialare not affected: they preserve theoriginal (incorrect) behavior, so existing streams remain reproducible.
(gh-31238)
datetime64/timedelta64arithmetic raises on overflowAddition, subtraction, and integer multiplication of
datetime64andtimedelta64values now raiseOverflowErrorwhen the result wouldoverflow
int64or land on theNaTsentinel value. Previously theseoperations silently wrapped, often producing a value that was indistinguishable
from
NaT. This matches the overflow checking already performed byunit-conversion casts.
(gh-31378)
C API changes
It is now possible to register
"real"and"imag"ArrayMethods viaPyUFunc_AddLoopsFromSpecs. These will be used forimagandrealand should normally set
*view_offsetin theirresolve_descriptorsfunction to allow the array attributes to return views.
(gh-30984)
New
PyDataType_TYPE,PyDataType_KIND,PyDataType_BYTEORDERandPyDataType_TYPEOBJaccessor macros to the C API. Together with the otheraccessor macros added for the NumPy 2.0 transition, these allow accessing the
fields of
PyArray_Descrstructs without any direct field accesses.(gh-30994)
NumPy now supports the stable ABI for free-threaded Python as described in
803{.interpreted-text role="pep"}.(gh-31091)
PyArray_DescrFromScalarnow returns the full dtype descriptor for scalarsof user-defined parametric data types, including any dtype parameters.
Parameters were previously silently discarded, which could cause incorrect
results in operations like
astypeon scalar objects. Internally, thefunction now delegates to
discover_descr_from_pyobject, which handlesparametric dtypes correctly.
(gh-31067)
New Features
It is now possible to register user-dtypes for dlpack export and import
via
numpy.dtypes.register_dlpack_dtype. This functionality is meant tobe used with care by user-dtype authors.
(gh-31256)
Pixi package definitions
Pixi package definitions have been added for different kinds
of from-source builds of NumPy. These can be used in
downstream Pixi workspaces via the
pixi-buildfeature.Definitions for both
defaultand AddressSanitizer-instrumented(
asan) builds are available in the source code under thepixi-packages/directory.linux-64andosx-arm64platforms are supported.(gh-30381)
numpy.ndarraynow supports structural pattern matchingnumpy.ndarrayand its subclasses now have thePy_TPFLAGS_SEQUENCEflagset, enabling structural pattern matching (PEP 634) with
match/casestatements. This also enables Cython to optimize integer indexing operations.
See
`arrays.ndarray.pattern-matching{.interpreted-text role="ref"}` for details.(gh-30653)
Added N-D evaluation functions to the polynomial package
New functions
polyvalnd,chebvalnd,legvalnd,hermvalnd,hermevalnd, andlagvalndhave been added to evaluate polynomialsin arbitrary dimensions, analogous to the existing 2D and 3D evaluators.
(gh-30857)
New "descending" keyword argument for
numpy.sortandnumpy.argsortUsers can now pass the
descending=Truekeyword argument tonumpy.sortand
numpy.argsortto sort and argsort arrays in descending order. NaNvalues, if present, are sorted to the end of the array in both ascending and
descending sorts. This feature is available for all built-in dtypes except
void,object, andgeneric. Note that SIMD optimizations for sortingare currently not available for descending sorts, so performance may be slower.
(gh-31345)
Improvements
For
f2py, the behaviour ofintent(inplace)has improved. Previously,if an input array did not have the right dtype or order, the input array was
modified in-place, changing its dtype and replacing its data by a corrected
copy. Now, instead, the corrected copy is kept a separate array, which, after
being passed and presumably modified by the fortran routine, is copied back to
the input routine. The above means one no longer has the risk that
pre-existing views or slices of the input array start pointing to unallocated
memory (at the price of increased overhead for the write-back copy at the end
of the call).
A potential problem would be that one might get very different results if one,
e.g., previously passed in an integer array where a double array was expected:
the writeback to integer would likely give wrong results. To avoid such
situations,
intent(inplace)will now only allow arrays that have equivalenttype to that used in the fortran routine, i.e.,
dtype.kindis the same. Forinstance, a routine expecting double would be able to receive float, but would
raise on integer input.
(gh-29929)
f2pymodules now show allocatable arrays indir()Allocatable module variables wrapped by
f2pynow appear indir()output, matching their accessibility by name.
(gh-30965)
StringDTypecomparisons now correctly handle embedded NULL bytes.(gh-31662)
Performance improvements and changes
Improved performance of
numpy.searchsortedThe C++ binary search implementation used by
numpy.searchsortednow has amuch better performance when searching for multiple keys. The new
implementation batches binary search steps across all keys to leverage cache
locality and out-of-order execution. Benchmarks show the new implementation can
be up to 20 times faster for hundreds of thousands keys while single-key
performance remains comparable to previous versions.
(gh-30517)
Improved scaling of ufuncs on free-threading
NumPy's ufuncs now scale significantly better on free-threading builds
of CPython due to the following optimizations:
a lock-free concurrent hash map, allowing multiple threads to call ufuncs
without contention.
handlers, have been made immortal. This effectively reduces reference
counting contention across threads.
PyMem_RawMallocandPyMem_RawFreefor memory allocation. On Python 3.15 and newer, thisleverages
mimallocand significantly reduces memory allocation overheadin multi-threaded workloads.
(gh-30846)
Faster reductions on small/medium contiguous arrays
numpy.sum,numpy.prod,numpy.any,numpy.all, and otherreductions with an identity value now use a fast path when the input is a
contiguous, aligned, non-object array and the reduction covers all axes
(
axis=None) with no special arguments. Typical speedup is ~1.3x on smallarrays;
numpy.any/numpy.allon contiguous boolean arrays can seespeedup up to 1.9x.
(gh-31274)
Typing improvements and changes
numpy.linalgtyping improvements and preliminary shape-typing supportInput and output dtypes for
numpy.linalgfunctions are now more precise.Several of these functions also gain preliminary shape-typing support while
remaining backward compatible. For example, the return type of
numpy.linalg.matmulnow depends on the shape-type of its inputs, or fallback to the backward-compatible return type if the shape-types are unknown at
type-checking time. Because of limitations in Python's type system and current
type-checkers, shape-typing cannot cover every situation and is often only
implemented for the most common lower-rank cases.
(gh-30480)
numpy.matyping annotationsThe
numpy.mamodule is now fully covered by typing annotations. Thisincludes annotations for masked arrays, masks, and various functions and
methods. With this, NumPy has achieved 100% typing coverage across all its
submodules.
(gh-30566)
Shape-typing support for many functions and methods
Many functions and methods now have shape-aware return type annotations.
Type-checkers can now infer the number of dimensions of the returned array
through common operations. For example,
np.linspace(0, 1)is now typed as a1-d
float64array, andnp.sum(x, keepdims=True)has the same number ofdimensions as
x.This covers
numpy.linalgfunctions, array creation functions (likeasarray,from{buffer,string,file,iter,regex}), range functions(
linspace,logspace,geomspace), aggregation functions and methods(
sum,mean,std,var,min,max,all,any,etc.), sorting (
sort,argsort,argpartition), cumulative operations(
cumsum,cumprod, etc.), set operations (unique_values,intersect1d,union1d, etc.), and various other functions includingnonzero,transpose,diagonal,atleast_{1,2,3}d,clip,round,inner,bincount, andfft.fftfreq. Several of these alsogained more precise return dtype annotations as part of this work.
Shape-typing is still a work-in-progress, so coverage is not yet complete.
Because of limitations in Python's type system and current type-checkers,
shape-typing is often only implemented for the most common lower-rank cases.
(gh-31172)
numpy.ffttyping improvements and preliminary shape-typing supportThe
numpy.fftfunctions now support non-float64/complex128dtypesand gain preliminary shape-typing support. For example, the return type of
numpy.fft.fftnow depends on the shape-type of its inputs, falling back tothe backward-compatible return type when the shape-types are unknown at
type-checking time.
(gh-31226)
Changes
Structured array copies now use
memcpyfor contiguous dtypesCopying structured arrays with identical dtypes now uses
memcpyinstead offield-by-field transfer when the dtype has a contiguous layout (no gaps between
fields). A new
NPY_NOT_TRIVIALLY_COPYABLEdtype flag is set on structureddtypes that have gaps in their memory layout, such as those created with
explicit
offsetsor via multi-field indexing. Only these dtypes continue touse the slower field-by-field copy.
This means that padding bytes in contiguous structured dtypes (e.g. those
created without explicit
offsets) may now be copied as part of thememcpy, whereas previously they were left untouched. Code that relies onpadding bytes being preserved during structured array copies may be affected.
(gh-29270)
numpy.ctypeslib.as_ctypesnow does not support scalar typesThe function
numpy.ctypeslib.as_ctypeshas been updated to only acceptnumpy.ndarray. Passing a scalar type (e.g.,numpy.int32(5)) will nowraise a
TypeError. This change was made to avoid the issuegh-30354 and to enforce the
readonly nature of scalar types in NumPy. The previous behavior relied on
undocumented implicit temporary arrays and was not well-defined. Users who
need to convert scalar types to ctypes should first convert them to an array
(e.g.,
numpy.asarray) before passing them tonumpy.ctypeslib.as_ctypes.(gh-30538)
__array_interface__changes on scalarsScalars now export the
__array_interface__directly rather than includingan array copy as a
__refentry. This means that scalars are now exported asread-only while they previously exported as writeable. The path via
__refwas undocumented and not consistently used even within NumPy itself.
(gh-30538)
meshgridnow always returns a tuplenp.meshgridpreviously used to return a list whensparsewas true andcopywas false. Now, it always returns a tuple regardless of thearguments.
(gh-30707)
numpy.triu_indicesnow acceptsunsigned integersnumpy.triu_indicespreviously used to error in some cases whenunsigned integerswere given as arguments. Now, it accepts them in all cases.
(gh-30869)
objectdtype in.realand.imagand related functionsThe array attributes
.realand.imagnow behave differently for objectarrays and return
getattr(element, "real", element)orgetattr(element, "imag", 0)elementwise. Additionally, the return for both is now read-only to avoid possible
in-place changes having no effect.
This change also affects
np.isreal()which usesarr.imag.Previously,
.imagalways returned0while.realreturned theoriginal array unmodified. The new behavior now returnes the correct values
for complex Python objects but may also lead to surprises for example if
element.real()is a method and not a property.(gh-30984)
NumPy's internal memory allocations now use
PyMem_RawMallocNumPy's internal memory allocations now use
PyMem_RawMallocinstead ofmallocand can be tracked bytracemalloc.(gh-31503)
v2.4.6Compare Source
v2.4.5: (May 15, 2026)Compare Source
NumPy 2.4.5 Release Notes
NumPy 2.4.5 is a patch release that fixes bugs discovered after the 2.4.4
release, has some typing improvements, and maintains infrastructure.
This release supports Python versions 3.11-3.14
Contributors
A total of 17 people contributed to this release. People with a "+" by their
names contributed a patch for the first time.
Pull requests merged
A total of 28 pull requests were merged for this release.
np.shapeassignability issue for python lists (#31171)pack_inner...tile: accept numpy scalars and arrays as second argument...ix_fix for boolean and non-1d input (#31218)_NestedSequencetype parameter default to work around...DTypeLikeruntime type-checker support (#31425)pytorch/pytorch (torch)
v2.13.0: PyTorch 2.13.0 ReleaseCompare Source
PyTorch 2.13.0 Release Notes
Highlights
nn.LinearCrossEntropyLosscombines the final prediction and loss computation to cut peak GPU memory by up to 4x for large-vocabulary language model training.torch.compiletargeting, and Intel XPU exposes new device telemetry APIs.For more details about these highlighted features, you can look at the release blogpost. Below are the full release notes for this release.
Tracked Regressions
ROCm wheels break
torch.compileon CPU in environments without a GPURunning a
torch==2.13.0+rocm7.2wheel in an environment where no GPU is available (torch.cuda.is_available()isFalse) breakstorch.compileon the CPU path: the first compile raisesRuntimeError: Can't detect vectorized ISA for CPU(#189194). This is a regression fromtorch==2.12.1+rocm7.2, which compiles CPU code fine (detecting e.g.VecAVX2) in the same setup. The 2.13 ROCm wheel appears to rely on something present in the ROCm builder image to detect the CPU vectorized ISA, so it works when run on a ROCm image but fails on a plain CPU-only image.Workaround: run the
+rocmwheel on a ROCm image, or install a standard CPU/CUDA build for GPU-less environments.Backwards Incompatible Changes
Stop building CPython 3.13t (free-threaded) binaries (#182951)
Upstream
pypa/manylinuxremoved CPython 3.13t (free-threaded) on 2026-05-07, because 3.13twas experimental and has been superseded by the now-non-experimental CPython 3.14t. As a result,
PyTorch 2.13 no longer ships
cp313twheels (Linux, Triton, and related artifacts). Users on thefree-threaded interpreter should move to Python 3.14t.
PyTorch 2.12:
# cp313t (free-threaded 3.13) wheels were available python3.13t -m pip install torchPyTorch 2.13:
# Use free-threaded Python 3.14t instead python3.14t -m pip install torchBare
PyObjectis no longer allowed in operator schemas (#184209)Bare
PyObjectwas accidentally accepted in operator schema strings inPyTorch 2.12. This was undocumented and is now rejected, since
torch.compiledoes not support arbitrary
PyObjectinputs to custom ops. Ifyou parse or register a schema with a bare
PyObjectargument or return type,you will now get a schema parse error.
PyTorch 2.12:
PyTorch 2.13:
Remove Bazel build support (#180883)
The Bazel build was never broadly adopted and still depended on the antiquated Bazel 6,
while the wider ecosystem has since moved to Bazel 9. All Bazel build files and CI jobs have
been removed. Users building PyTorch with Bazel should migrate to the supported CMake/
pip installbuild flow.
PyTorch 2.12:
# Build PyTorch with Bazel bazel build //:torchPyTorch 2.13:
Enforce C++20 minimum in header guards (#178150). In PyTorch 2.13, C++20 is now required to import PyTorch headers.
StorageImpl's built-in copy-on-write (COW) materialization is replaced by a pluggable materializer hook (#179063)StorageImplno longer knows about COW directly. Its internal COW entry pointsStorageImpl::is_cow(),StorageImpl::maybe_materialize_cow(), and the friendcow::materialize_cow_storage()have been removed in favor of a single pluggableMaterializeFnhook (void(*)(StorageImpl*)) that a backend registers to run once,on the first mutable data-pointer access. COW is now just one consumer of this hook
(
c10::impl::cow::materialize_cow), and all COW behavior (lazy clone, refcountedshared data, copy-on-write) is unchanged. This also gives accelerator backends and
eager-mode graph compilers a zero-fast-path-cost place to commit deferred allocations
or materialize symbolic buffers on first mutation.
This is a C++-only change. It affects out-of-tree backends/extensions that called the
removed
StorageImplCOW symbols directly; they will fail to compile against 2.13with errors such as
no member named 'is_cow' in 'c10::StorageImpl'. Migrate to thenew hook API (
set_materializer()/has_materializer()/clear_materializer()).PyTorch 2.12:
PyTorch 2.13:
Convert
shared_ptr<Node>tointrusive_ptr<Node>(#181139). This changes the signature ofTensor::grad_fn. Accesses toTensor.grad_fn()should change fromstd::shared_ptr<Node>toc10::intrusive_ptr<Node>. Similarly, construction of a C++ autograd function should change:PyTorch 2.12:
PyTorch 2.13:
auto node = c10::make_intrusive<CustomCppNode>();The minimum supported NCCL version when building from source is now 2.23 (#186292)
PyTorch now requires NCCL >= 2.23 at compile time, and the preprocessor/runtime gates that guarded NCCL features introduced in 2.23 or earlier have been removed. Users who build PyTorch from source against a system NCCL older than 2.23 will hit compile errors against the dropped gates. Upgrade the NCCL installation to >= 2.23 to build. The prebuilt PyTorch wheels already bundle a compatible NCCL, so pip/conda users are unaffected.
Remove named tensors (#173895)
The named tensor feature (a long-deprecated prototype) has been fully removed to reduce overhead and code bloat. All associated Python and C++ APIs are gone, including
Tensor.names,Tensor.rename(),Tensor.refine_names(),Tensor.align_to(),Tensor.align_as(),torch.align_tensors(), thenames=keyword on factory functions (e.g.torch.zeros,torch.empty,torch.ones), and the C++Dimname/DimnameListAPIs. Code that previously relied on named dimensions must track dimension order positionally and avoid usage of any of these now-removed APIs or op overloads.The
onednn::qconv2d_pointwise.binaryand.binary_tensoroperators no longer alias their input but rather return fresh tensors. Previously these ops mutated theqaccuminput buffer and returned it directly, violating the PyTorch invariant that custom operator outputs must not alias inputs. This silently bypassed aliasing checks via the old-> Tensor(a!)schema and would become a hard error in a future PyTorch version (as mentioned in #182063), so the schema and implementation were corrected to return a fresh output. Most users are unaffected, only code that calls these ops directly and relies on the in-place mutation of qaccum must now read the returned tensor instead. (#177171)Deprecations
Custom operators that return an output aliasing one of their inputs are deprecated (#182063)
When a custom operator returns an output that is the same tensor as (or otherwise aliases) one of its inputs under
torch.compile, PyTorch now emits aUserWarningstating that this is deprecated and will become an error in a future version of PyTorch. Previously the warning stated the change would land in PyTorch 2.12; that timeline has been pushed back. To update your code, return a clone of the offending output instead of the input, or refactor the operator so it does not return the aliased tensor.Deprecated:
Updated:
Creating tensors with the quantized dtypes
quint8,qint8, andqint32is now deprecated and emits a warning. This covers both Python and C++ call sites; see #184982 for migration guidance (#184984)PyTorch 2.12:
PyTorch 2.13:
Rename distributed collective ops to the
_singlenaming scheme and deprecate the old names (#186123, #186124, #186125, #186134, #186135, #186144)To align the public
torch.distributedcollective APIs with the naming used by torchcomms'TorchCommBackend,all_gather_into_tensoris renamed toall_gather_singleandreduce_scatter_tensortoreduce_scatter_single. The previous names continue to work as thin wrappers that delegate to the new functions, but now emit aFutureWarning.PyTorch 2.12:
PyTorch 2.13:
New Features
Python Frontend
torch.Tag.inplaceandtorch.Tag.out, that let an operator declare how it writes its result:inplacemeans it mutates a tensor in place, andoutmeans it writes into a caller-provided output tensor. Native PyTorch operators are tagged automatically, and custom operators defined withtorch.librarycan opt in by adding the tag. To be taggedinplace, an operator must take the tensor it mutates as its first positional argument (declared asTensor(a!), and the only mutable argument) and return that same tensor. Tagging a custom operator this way improves its behavior undertorch.compile:inplaceops now go throughauto_functionalize, so the reinplacing pass can analyze clones and skip unnecessary copies, and bothinplaceandoutops get their fake/meta kernels generated for free. See the Python custom operators tutorial for how to author and tag custom operators. (#181100, #181099, #184199, #184200, #184201, #184202, #184203, #180851, #180852)const_data_ptr()Python binding totorch.Tensorfor read-only data pointer access (#180382)abbrproperty totorch.dtypethat returns a dtype's short string abbreviation (e.g.torch.float32.abbrreturns"f32") (#177296)Functions (#182206)rearrangein thetorch.funcnamespace for einops-style tensor reshaping (#173183)torch.nn
nn.LinearCrossEntropyLoss, a fused linear-projection plus cross-entropy loss module that avoids materializing the full logits tensor (#181573, #185852, #172286, #186113)Autograd
torch.autograd.graph.region_activation_memory_budget(#185979)dicttotorch.autograd.gradandtorch.autograd.backward(#178140)Distributed
Add a registration API for symmetric memory arguments (
lib.register_symm_mem_args()), letting operators (including out-of-tree ops) declare which arguments require symmetric-memory allocation (#173513)Remove
NCCLSymmetricMemory's explicit dependency onProcessGroupNCCL, enabling symmetric memory to work with out-of-tree backends such as torchcomms (#184260)Support accessing the
ReduceOp.PREMUL_SUMfactor from Python when implementing process group backends in Python (#185863)Expose the NCCL 2.30
maxP2pPeersconfig binding (#181686)Add rocSHMEM Triton integration for symmetric memory on ROCm (#178658)
Support passing extra keyword arguments to the loss function in pipeline schedules via a new
loss_kwargsparameter tostep(), enabling loss functions that require arguments beyond(output, target)(such as chunked cross-entropy needing token counts for scaling) (#181057)Distributed FSDP2
FSDPModule.set_separate_reduce_scatter_groupto give reduce-scatter its own NCCL communicator, enabling opt-in overlap of all-gather and reduce-scatter (#186335)set_reduce_scatter_max_input_buffersto keep multiple reduce-scatter input buffers in flight, so backward compute no longer stalls waiting to recycle a single reduce-scatter buffer (#186000)Profiler
Dynamo
torch.compiler.set_default_backendto override the defaulttorch.compilebackend globally, so out-of-tree backend authors don't need to passbackend=at every call site (following the pattern oftorch.set_default_dtype/torch.set_default_device). Explicitbackend=arguments still take precedence (#178944)torch.compile(f, isolate_recompiles=True)to give eachtorch.compilecall its own isolated cache bucket, preventing cross-compile interference in cache lookups and recompile-limit checks when multipletorch.compilecalls target the same function (#178351)register_multi_grad_hooksupport to@leaf_function, allowing a backward hook to fire once per backward pass when allrequires_gradinputs have their gradients computed (#179609)Inductor
FlexAttentiontemplate (chosen when query length is 1) with a new configurablePARTITION_SIZEkernel option (#159835)decomp_comms) that eliminatesall_gatherfor Gram-matrix optimizer patterns (Muon/Shampoo) under FSDP, gated byconfig.aten_distributed_optimizations.allow_comms_decompositions, yielding 1.25-1.95x training speedups (#184370)Ahead-Of-Time Inductor (AOTI)
TORCH_TARGET_VERSION, so shims introduced in newer releases are only exposed when the target version supports them (#181916)torch._inductor.aoti_compile_and_package/aoti_load_packageAPI, including packaging and loading of the multiple.sofiles emitted per kernel (#182251)torch_exception_get_what,torch_exception_get_what_without_backtrace, andSTABLE_TORCH_ERROR_CODE_CHECK) so extensions built against the stable ABI can retrieve the original error message across the C API boundary (target version 2.13+) (#180135)aoti_torch_stream_native_handleandtorch::stable::accelerator::Stream::nativeHandle(), gated behindTORCH_FEATURE_VERSION >= 2.13, for retrieving a native stream handle from the stable ABI (#183930)Release Engineering
CUDA
CUDAGraph.get_graph_data()for graph topology introspection (#183165)MPS
torch.distributions.Dirichleton MPS by adding_sample_dirichletand_dirichlet_gradMetal implementations (#185458, #185854)grid_sampler_2dbackward support on MPS (#179756)grid_sampler_3dbackward support on MPS (#179388)lcmsupport on MPS via a new Metal kernel (#186279)c10/metal/reduction_utils.h(#180708) and a complex->bool specialization (#185938)ROCm
enable_language(HIP)(#180485)XPU
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR was generated by Mend Renovate. View the repository job log.