# Tensor subclass

**URL:** https://dev-discuss.pytorch.org/c/tensor-subclass/29.md

[Latest](https://dev-discuss.pytorch.org/latest.md) · [Categories](https://dev-discuss.pytorch.org/categories.md)

---

## [About the Tensor subclass category](https://dev-discuss.pytorch.org/t/about-the-tensor-subclass-category/2046)

<div class="topic-metadata">

**Author:** [@albanD](https://dev-discuss.pytorch.org/u/albanD)\
**Replies:** 0

</div>

This category is for any announcement or implementation question related to Tensor subclasses as discussed in Extending PyTorch — PyTorch 2.3 documentation .

---

## [DanLing NestedTensor on variable-length inputs: IMDB, model, and operator benchmarks](https://dev-discuss.pytorch.org/t/danling-nestedtensor-on-variable-length-inputs-imdb-model-and-operator-benchmarks/3342)

<div class="topic-metadata">

**Author:** [@ZhiyuanChen](https://dev-discuss.pytorch.org/u/ZhiyuanChen)\
**Replies:** 0\
**Last updated:** [April 7, 2026, 10:29am UTC](https://dev-discuss.pytorch.org/t/danling-nestedtensor-on-variable-length-inputs-imdb-model-and-operator-benchmarks/3342 "2026-04-07T10:29:17Z")

</div>

We’ve been working on DanLing NestedTensor, a NestedTensor implementation for variable-length tensors with broad PyTorch op coverage, and wanted to share some benchmark results. To avoid confusion up front: this is abou…

---

## [Reviving Named Tensors: Strategy for addressing the "Experimental" backlog](https://dev-discuss.pytorch.org/t/reviving-named-tensors-strategy-for-addressing-the-experimental-backlog/3289)

<div class="topic-metadata">

**Author:** [@adendek](https://dev-discuss.pytorch.org/u/adendek)\
**Replies:** 0\
**Last updated:** [January 14, 2026, 11:15pm UTC](https://dev-discuss.pytorch.org/t/reviving-named-tensors-strategy-for-addressing-the-experimental-backlog/3289 "2026-01-14T23:15:22Z")

</div>

Hi everyone, I’ve been looking into the current state of Named Tensors. Despite the clear UX benefits for model readability and error prevention, the feature has remained in an experimental state with a growing list of o…

---

## [Graphs when moving tensors between devices](https://dev-discuss.pytorch.org/t/graphs-when-moving-tensors-between-devices/3267)

<div class="topic-metadata">

**Author:** [@Johannes99](https://dev-discuss.pytorch.org/u/Johannes99)\
**Replies:** 0\
**Last updated:** [November 14, 2025, 4:30pm UTC](https://dev-discuss.pytorch.org/t/graphs-when-moving-tensors-between-devices/3267 "2025-11-14T16:30:50Z")

</div>

Hello everyone! Since I have a little experience with PyTorch’s backend now, I am wondering about a quirk I have seen: As far as I know, tensors lose their graph when we move them between devices, due to the different …

---

## [Correct way to extend pytorch sparse Tensor class - C++/CUDA](https://dev-discuss.pytorch.org/t/correct-way-to-extend-pytorch-sparse-tensor-class-c-cuda/3237)

<div class="topic-metadata">

**Author:** [@ricvigi](https://dev-discuss.pytorch.org/u/ricvigi)\
**Replies:** 1\
**Last updated:** [September 29, 2025, 7:21pm UTC](https://dev-discuss.pytorch.org/t/correct-way-to-extend-pytorch-sparse-tensor-class-c-cuda/3237 "2025-09-29T19:21:38Z")

</div>

Hi, I’m writing an implementation for a new sparse matrix format that i wish to integrate in the pytorch tensor class. What i’m trying to implement is a functionality that works similarly to the one already present for …

---

## [What is the right way to use decompositions in dispatch mode?](https://dev-discuss.pytorch.org/t/what-is-the-right-way-to-use-decompositions-in-dispatch-mode/2888)

<div class="topic-metadata">

**Author:** [@qihqi](https://dev-discuss.pytorch.org/u/qihqi)\
**Replies:** 0\
**Last updated:** [April 5, 2025, 5:40pm UTC](https://dev-discuss.pytorch.org/t/what-is-the-right-way-to-use-decompositions-in-dispatch-mode/2888 "2025-04-05T17:40:59Z")

</div>

What I want to accomplish Given a non-core-aten operator P decompose it into core aten ops using the a decomposition table. If the decomposition in the table doesn’t consist of only core Aten ops, then keep going (recurs…

---

## [\[Solved\] Overwriting max() leads to AttributeError](https://dev-discuss.pytorch.org/t/solved-overwriting-max-leads-to-attributeerror/2726)

<div class="topic-metadata">

**Author:** [@pascal-mueller](https://dev-discuss.pytorch.org/u/pascal-mueller)\
**Replies:** 1\
**Last updated:** [January 3, 2025, 10:42am UTC](https://dev-discuss.pytorch.org/t/solved-overwriting-max-leads-to-attributeerror/2726 "2025-01-03T10:42:53Z")

</div>

Hello, I run into a AttributeError while working on my tensor wrapper subclass. If you are curious, you can read here about the ultimate goal. The tensor below is a minimal example to reproduce the error. Basically I u…

---

## [Extension points for Tensor subclasses composability with \`nn.Module\`](https://dev-discuss.pytorch.org/t/extension-points-for-tensor-subclasses-composability-with-nn-module/2047)

<div class="topic-metadata">

**Author:** [@mikaylagawarecki](https://dev-discuss.pytorch.org/u/mikaylagawarecki)\
**Replies:** 0\
**Last updated:** [May 1, 2024, 6:20pm UTC](https://dev-discuss.pytorch.org/t/extension-points-for-tensor-subclasses-composability-with-nn-module/2047 "2024-05-01T18:20:18Z")

</div>

There are some recent additions for composability of Tensor Subclasses with nn.Module. In particular, An extension point for load\_state\_dict that one can use to define custom logic when loading to/from subclasses with…
