akankshakshurai/cuda-error-resolution-analysis huggingface dataset:
Tensor as a shared_ptr

Wesley_Neill: <p>As I understand it, torch::Tensor is analogous to a shared_ptr.</p>
<p>So, if I reassign a Tensor, is it a correct assumption that</p>
<ol>
<li>The memory associated with the previously held value will be deleted if no other pointers are sharing that value?</li>
<li>If two scopes own the same Tensor memory, say Class A and Class B, I can assume that changes made to the underlying tensor data in Class A will propagate to Class B?</li>
</ol>

marksaroufim: <p>You might enjoy building some simple programs with <code>data_ptr</code></p>
<pre><code class="lang-auto">a = torch.ones(2, 3)
a.data_ptr()
</code></pre>
C++/Cuda / aot.compile and cuda graph

Benjamin_Sergeant: <p>Hi there,</p>
<p>We are playing with <a href="https://github.com/pytorch/pytorch/blob/main/docs/source/torch.compiler_aot_inductor.rst" rel="noopener nofollow ugc">ahead of time compilation (AOTInductor)</a>, to be able to produce models that can be executed by a C++ program ; we’ve seen great results, but results seems even better when the ‘cuda-graph’ options are used, however that doesn’t seem to work with inductor which is the default value used with AOT.</p>
<p>Is there a fundamental reason this cannot work, or is there hope it can with some work ?</p>
<p>Thanks !</p>

ChuanqiXu9: <p>+1 here, is there any reasons?</p>

prateekp: <p>+1 can we enable cuda craphs with AOTcompiled models ?</p>
Pybind11v3 support

pya: <p>I understand that PyTorch uses pybind11 internally. I am wondering if that usage will be moved to pybind11v3? It has attractive features such as support for dynamic attributes and <code>py::smart_holder</code> for managing references.</p>

swolchok: <p><code>py::native_enum</code> might also be nice.</p>
Jagged Nested Tensors: view of a nested tensor where dimension size is inferred

stmio: <p>Is it possible to create a view of a jagged tensor where a size is inferred? I have a tensor of size <code>(3, j4, 4)</code> and want to create a view of size <code>(3, 4*j4)</code>. I tried to use <code>tensor.view(3, -1)</code> as I would do with a regular tensor but this does not seem to work. Why is this? (i.e. not implemented or by design of nested tensors?)</p>
<pre data-code-wrap="python"><code class="lang-python">&gt;&gt;&gt; e = torch.nested.nested_tensor([e1,e2,e3], layout=torch.jagged)
&gt;&gt;&gt; e.shape
torch.Size([3, j4, 4])
&gt;&gt;&gt; f = torch.nested.nested_tensor([ep.flatten() for ep in e.unbind()], layout=torch.jagged)
&gt;&gt;&gt; f.shape
torch.Size([3, j5])
&gt;&gt;&gt; e.view(3, -1)
RuntimeError: view(): cannot view shape (3, j4, 4) as [3, -1]
</code></pre>
<p>The result I am looking for from <code>.view()</code> is equivalent to the tensor <code>f</code> in the snippet above.</p>
<p>If it does not work because it is not yet implemented rather than by design, would this be a tricky feature to add?</p>
<p>Cheers for the help</p>

stmio: <p>Have opened a discussion regarding implementing this: <a href="https://github.com/pytorch/pytorch/issues/161287" class="inline-onebox" rel="noopener nofollow ugc">Add partial shape inference support when creating a `view()` of a Nested Jagged Tensor · Issue #161287 · pytorch/pytorch · GitHub</a></p>
Possible regression in nn.Dropout speed on cpu in pytorch 2.7 and 2.8

andrea-cos: <p>Hi,</p>
<p>On pytorch 2.7 and 2.8, I noticed that running the nn.Dropout layer on cpu seems to take much longer than on pytorch 2.6. The following script on my laptop took 0.87s with pytorch 2.6 and 16.85s with 2.8.</p>
<pre data-code-wrap="python"><code class="lang-python">from time import time

import torch
from torch import nn
from tqdm import trange

N_STEPS = 10_000
BATCH_SIZE = 256
D = 500
DEVICE = "cpu"


class M(nn.Module):
    def __init__(self):
        super().__init__()
        self.dropout = nn.Dropout(0.1)

    def forward(self, x):
        x = self.dropout(x)
        return x


data_float = torch.rand((BATCH_SIZE, D), device=DEVICE)
model = M()
model.to(device=DEVICE)
start = time()
for _ in trange(N_STEPS):
    model(data_float)
print(f"\nElapsed({torch.__version__}): {time() - start}s")
</code></pre>
<p>This slow down seems to be present only on cpu, not on cuda.</p>
<p>The cpu used for the test is an Intel(R) Core™ i7-8750H CPU @ 2.20GHz, but the same behavior was seen on other cpus as well.</p>
<p>Pytorch was installed simply with `python -m pip install -U numpy “torch&lt;2.7” tqdm` for 2.6, and removing the version limit for 2.8.</p>

lisa845jyorg: <p>Thanks for confirming this issue I’ve been noticing the same drastic slowdown in nn.Dropout on CPU after upgrading to PyTorch 2.7/2.8 and was starting to think it was just my <a href="https://www.hctra.it.com" rel="noopener nofollow ugc">hctra org</a> setup. Glad to know it’s a recognized regression and already being tracked.</p>

ptrblck: <p>Could you please create a GitHub issue for this regression so the code owners can take a look at it?</p>

andrea-cos: <p>Thanks for the reply. I was going to do it, but I found that somebody else already opened it <a href="https://github.com/pytorch/pytorch/issues/161163" rel="noopener nofollow ugc">here</a></p>
Is it possible that node's name can change during torch.compile?

ChrisRR: <p>I encountered a fatal error when the function <code>get_kernel_metadata</code> executes:</p>
<pre data-code-wrap="bash"><code class="lang-bash">Traceback (most recent call last):
  ...
  File "/home/.pyenv/versions/3.11.9/lib/python3.11/site-packages/torch/_inductor/utils.py", line 597, in get_kernel_metadata
    inductor_nodes.sort(
  File "/home/.pyenv/versions/3.11.9/lib/python3.11/site-packages/torch/_inductor/utils.py", line 598, in &lt;lambda&gt;
    key=lambda n: single_graph._inductor_kernel_metadata_node_to_idx_map[n]
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
KeyError: slice_scatter_default_5
</code></pre>
<p>I printed out the graph <code>single_graph</code> whenever it is not None, and I can see that with the same <code>id(single_graph)</code>, the <code>single_graph</code> changes during the whole inductor compilation. Yet, the changes are quite minor as <strong>only some nodes’ name</strong> are modified somehow.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/5/45b976f5c71f3f3912ff9c4ad3552a9b3a7d9edd.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/45b976f5c71f3f3912ff9c4ad3552a9b3a7d9edd" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/5/45b976f5c71f3f3912ff9c4ad3552a9b3a7d9edd_2_690x244.jpeg" alt="image" data-base62-sha1="9WOiHOMTe2nZ17cpe14ZvMY0J8V" width="690" height="244" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/5/45b976f5c71f3f3912ff9c4ad3552a9b3a7d9edd_2_690x244.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/4/5/45b976f5c71f3f3912ff9c4ad3552a9b3a7d9edd_2_1035x366.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/4/5/45b976f5c71f3f3912ff9c4ad3552a9b3a7d9edd.jpeg 2x" data-dominant-color="E2DCDB"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1370×486 127 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>My questions are:</p>
<ol>
<li>Is it possible that a node’s name can change during torch.compile? If so, which method or procedure should I look into?</li>
<li>I’m now using PyTorch 2.6, and I see that the <code>torch/_inductor/utils.py</code> file is not updated wrt this <code>get_kernel_metadata</code>. Is there any consumption behind this method, or is there any bug?</li>
</ol>
DDPM single step validation is good but multi-step test is bad

Chen_Jin: <h1><a name="p-474575-ddpm-single-step-validation-is-good-but-multi-step-test-is-bad-1" class="anchor" href="#p-474575-ddpm-single-step-validation-is-good-but-multi-step-test-is-bad-1"></a><strong>DDPM single step validation is good but multi-step test is bad</strong></h1>
<p>The training phase of DDPM is done by randomly generating a t from 1 to T and noise the image up to this generated t. Then use the model to predict the noise that was added to the partially noised image. So we are predicting the noise from x_0 to x_t.</p>
<p>I trained the model for 1000 epochs with T = 500, and did validation using the exact same procedure as training. i.e. I partially noised the image in validation set and let the trained model to predict the noise (from x_0 to x_t, single step) that was added to the partially noised image. The single step validation set result is decent, the plot looks fine.</p>
<p>However, for the test set, we start from pure noise and do multi-step iteration to denoise. The test set quality is bad.</p>
<p><strong>What is the issue that caused single-step validation result looks fine but multi-step test set looks bad? What should I check and what are the potential issues.</strong></p>
<p>I also noticed, both training and validation loss has very similar shape and both dropped fast in first 50 epochs, and it plateaued. The gradient norm is oscillating between 0.8 to 10 most of the time and I clipped it to 1.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/5/a/5af3f5ea190dc727cb96518904baaf08f75a0c29.png" data-download-href="https://discuss.pytorch.org/uploads/default/5af3f5ea190dc727cb96518904baaf08f75a0c29" title="loss_curves"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/5/a/5af3f5ea190dc727cb96518904baaf08f75a0c29_2_600x500.png" alt="loss_curves" data-base62-sha1="cYBEDPlb3tskVrVQGlIT8iVU1kZ" width="600" height="500" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/5/a/5af3f5ea190dc727cb96518904baaf08f75a0c29_2_600x500.png, https://discuss.pytorch.org/uploads/default/optimized/3X/5/a/5af3f5ea190dc727cb96518904baaf08f75a0c29_2_900x750.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/5/a/5af3f5ea190dc727cb96518904baaf08f75a0c29_2_1200x1000.png 2x" data-dominant-color="FBFBFA"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">loss_curves</span><span class="informations">1800×1500 122 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>Also, I tried to overfit a single batch but the loss plateaued at 0.1.</p>
<p>What is the next step to do and fix the single-step and multi-step issue?</p>
Efficient dataset saving/loading for large PyG graphs (8000 patients or more)

hadrien_calmet: <p>Hi everyone</p>
<p>I am building a large torch_geometric dataset with ~8,000 object(.pt) , are patients in my case.<br>
Each patient contains several tensors, producing a Data object (node features, edge indices, and a single target value).</p>
<p>Originally, I saved each graph as a separate .pt file, so I had ~2000 files for a smaller test case(around 200 GB). This was easy to load but took too much storage space.</p>
<p>I tried to reduce it, saving batches of 20 graphs into a single compressed file (.pt.xz).</p>
<p>the reduction of space was drastic ! but loading and training was impossible.</p>
<p>What’s the recommended PyTorch/PyG-friendly way to:</p>
<p>Store large datasets of graphs efficiently (compression + batching)?</p>
<p>Load them quickly in <strong>getitem</strong> without hanging?</p>
<p>Keep global indices consistent after batching?</p>
<p>Thank you</p>
<p>any advice is welcome</p>

hadrien_calmet: <p>After many attempts, I finally found an effective way to compress my dataset without slowing down the training phase. I now save batches of 20 graphs into a single compressed file using LZ4 compression (.pkl) with <code>joblib.dump</code>, and later load them with <code>joblib.load</code>. This approach drastically reduced the dataset size—from 1TB down to 80GB."</p>
C++ nn::module Pybind11 unexpected behavior

pya: <p>Hi,</p>
<p>I have a mynet.cpp file defined as follows:</p>
<pre><code class="lang-auto">/* 
c++ -O3 -Wall -fvisibility=hidden -Winvalid-pch -shared -std=c++17 -fPIC `python3 -m pybind11 --includes` -I../../../extension-cpp-meson-murali/.venv/include/python3.13 -I../../../extension-cpp-meson-murali/.venv/lib/python3.13/site-packages/torch/include -I../../../extension-cpp-meson-murali/.venv/lib/python3.13/site-packages/torch/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=1 '-DPYBIND11_BUILD_ABI="_cxxabi1016"' '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' -fPIC mynet.cpp -o mynet`python3-config --extension-suffix` -L../../../extension-cpp-meson-murali/.venv/lib/python3.13/site-packages/torch/lib -ltorch -ltorch_cpu -lc10 -ltorch_python
*/


#include &lt;torch/torch.h&gt;
#include &lt;torch/extension.h&gt;

using namespace torch;

struct NetImpl : public nn::Module {
  NetImpl(int64_t in_sz, int64_t out_sz) :
    lin1(nn::LinearOptions(in_sz, out_sz))
  {
    register_module("lin1", lin1);
  }

  torch::Tensor forward(torch::Tensor x) {
    return lin1(x);
  }
  private:
    nn::Linear lin1;
};


TORCH_MODULE(Net);


PYBIND11_MODULE(mynet, m) {
py::class_&lt;torch::nn::ModuleHolder&lt;NetImpl&gt;&gt;(m, "NetImpl");

py::class_&lt;Net, torch::nn::ModuleHolder&lt;NetImpl&gt; /* &lt;- specify C++ parent type */&gt;(m, "Net")
   .def(py::init&lt;int64_t, int64_t&gt;())
   .def("forward", [] (Net&amp; n, torch::Tensor x) { n-&gt;forward(x);} )
   .def("__call__", [] (Net&amp; n, torch::Tensor x) { n-&gt;forward(x);} );

}

</code></pre>
<p>My intent is to call the Net module from Python. I compiled it as follow and it compiles fine.</p>
<pre><code class="lang-auto"> c++ -O3 -Wall -fvisibility=hidden -Winvalid-pch -shared -std=c++17 -fPIC `python3 -m pybind11 --includes` -I../../../extension-cpp-meson-murali/.venv/include/python3.13 -I../../../extension-cpp-meson-murali/.venv/lib/python3.13/site-packages/torch/include -I../../../extension-cpp-meson-murali/.venv/lib/python3.13/site-packages/torch/include/torch/csrc/api/include -D_GLIBCXX_USE_CXX11_ABI=1 '-DPYBIND11_BUILD_ABI="_cxxabi1016"' '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' -fPIC mynet.cpp -o mynet`python3-config --extension-suffix` -L../../../extension-cpp-meson-murali/.venv/lib/python3.13/site-packages/torch/lib -ltorch -ltorch_cpu -lc10 -ltorch_python
</code></pre>
<p>This is how I am attempting to use it in Python:</p>
<pre><code class="lang-auto"> python
Python 3.13.5 (main, Jun 11 2025, 15:36:57) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import torch
&gt;&gt;&gt; from mynet import Net
&gt;&gt;&gt; net = Net(10,10); x=torch.randn(10)
&gt;&gt;&gt; y=net(x)
&gt;&gt;&gt; x
tensor([-0.0401, -0.1749, -1.1672, -0.1334,  0.6920, -0.4041,  0.3758,  1.1046,
         2.0517,  1.3911])
&gt;&gt;&gt; y
&gt;&gt;&gt;
</code></pre>
<p>As you can see there are no errors. But, nothing is printing for y. How can I make it work?</p>

pya: <p>Never mind. I fixed it. The lambda needed a return statement.</p>
2nd derivative for attn is not working

mliu: <p>Hi,</p>
<p>I have a Transformer-based energy-based model (built with PyTorch nn.TransformerEncoderLayer). I am computing the derivative of the model in the loss definition and then using loss.backward() to train the model. Basically, I need to <strong>take the 2nd derivative of the model</strong>.</p>
<p>To do this, with PyTorch 2.1.0, I met the error <code>RuntimeError: derivative for aten::_scaled_dot_product_efficient_attention_backward is not implemented</code>. But it was working when I used PyTorch 1.13.0.</p>
<p>Is there any solution for this with <strong>PyTorch 2.1.0</strong>? Thank you!</p>

Suya_Li: <p>I have exact the same issue. Does anyone know how to solve this? Thanks a lot!</p>

mliu: <p>Writing a Transformer encoder with plain PyTorch operations (matmul etc) can bypass this.</p>

SSamDav: <p>Do we have any news about this issue?</p>
Industry-Related Groups for Pytorch Forums

mycul: <p>I feel like allowing for the creation of certain groups based on industry (such as for manufacturing, medical, etc) might be beneficial to include somewhere in this site.</p>
<p>It would allow people to share wisdom that extends beyond the issues of pytorch errors in a more centralized location.</p>
<p>I find myself having to search quite a bit for certain solutions and strategies online that are highly specific to the realities of a modern manufacturing process (low labeled data, low compute availability, extremely large images) and I imagine there are a lot of people who share the same struggle.</p>
What happened to the libtorch linalg namespace?

bmanga: <p>The c++ <code>torch::linalg</code> namespace seems to have completely disappeared from the latest releases, apparently replaced with name changes (eg. <code>torch::linalg::vector_norm</code> to <code>torch::linalg_vector_norm</code>). But there seems to be no information/changelog available online about this! And most documentation still refers to the old namespace.</p>
<p>I understand that PyTorch is primarily python-focused, but wouldn’t such a big change for the c++ API at least warrant a changelog or some information being pushed out about it? I’d be also curious to hear the reasoning about it, as it seems to diverge from the python convention (eg <code>torch.linalg.vector_norm</code>)!</p>

ptrblck: <p><a href="https://github.com/pytorch/pytorch/pull/138435">This PR</a> removed the namespace in Oct. 2024 as apparently only one OSS project used it.</p>
Integrating libtorch with Unreal Engine 5.5 on Ubuntu

sjacr: <p>We are building a project on Ubuntu 20.04/22.04 using Unreal Engine 5.5, which requires integrating <strong><code>libtorch-cu12</code></strong>. However, Unreal Engine is compiled with Clang and uses STL <strong><code>libc++</code></strong>, while <strong><code>libtorch</code></strong> is built with GCC and relies on STL <strong><code>libstdc++</code></strong>. This causes direct build failures due to STL symbol conflicts.</p>
<p>Our current potential solution is to recompile <strong><code>libtorch</code></strong> from source using Clang to align with Unreal’s toolchain. Is this the optimal approach?  Any insights or alternative methods with higher feasibility. Thank you in advance for your help!</p>
I want advice on Optimizing Deep Learning Models in PyTorch

Charlotte: <p>Hi everyone,</p>
<p>I have been experimenting with PyTorch for a while, building small deep learning projects just to get the hang of things. Also I tried training a larger model for image classification but I feel such as I am not handling optimization the right way. My model works but the training speed is slow &amp; the accuracy seems to get stuck after a few epochs. I am using Adam as the optimizer with a learning rate scheduler; yet the improvements feel minimal.</p>
<p>I wanted to ask what approaches or tricks you all use when your PyTorch models hit a performance plateau. Do you  tweak hyperparameters more aggressively or do you focus on adjusting the architecture itself? Also if you have worked on larger datasets, how do you usually manage training without running into memory issues?</p>
<p>I am also exploring backend development with a <a href="https://www.igmguru.com/digital-marketing-programming/ruby-on-rails-certification-training" rel="noopener nofollow ugc">Ruby On Rails course</a> so I am trying to balance learning both sides of the tech world.</p>
<p>Also i have check this <a href="https://discuss.pytorch.org/t/parameter-optimization-of-a-pytorch-deep-learning-model/132301" class="inline-onebox">Parameter optimization of a pytorch Deep Learning model</a> still need advice.</p>
<p>Thank you.<img src="https://discuss.pytorch.org/images/emoji/apple/slight_smile.png?v=14" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
Task Manager shows disk I/O only for one worker on Windows with `num_workers>0`

crazyboy9103: <p>Hi,</p>
<p>I was training on a Windows machine with <code>num_workers &gt; 0</code> and found in the task manager that only one worker has disk I/O.<br>
<a href="https://private-user-images.githubusercontent.com/59700837/479492673-2718c6f1-0a63-4292-a274-75a1959007e0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTU2NTIxNjgsIm5iZiI6MTc1NTY1MTg2OCwicGF0aCI6Ii81OTcwMDgzNy80Nzk0OTI2NzMtMjcxOGM2ZjEtMGE2My00MjkyLWEyNzQtNzVhMTk1OTAwN2UwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwODIwVDAxMDQyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRlOWEzMDI5NDhhZmQyODk5ZGQwZGQxOGVjMGIzY2JlZjVlYzM2NTZlYjFmOTRlZGU1MzY1MDFmM2U5ZDE1OTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.oZFmpEPZPAUCOlgRXHLH6oC9WDs39W_pHjcdfgJJFro" rel="noopener nofollow ugc"><img src="https://private-user-images.githubusercontent.com/59700837/479492673-2718c6f1-0a63-4292-a274-75a1959007e0.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTU2NTIxNjgsIm5iZiI6MTc1NTY1MTg2OCwicGF0aCI6Ii81OTcwMDgzNy80Nzk0OTI2NzMtMjcxOGM2ZjEtMGE2My00MjkyLWEyNzQtNzVhMTk1OTAwN2UwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA4MjAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwODIwVDAxMDQyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRlOWEzMDI5NDhhZmQyODk5ZGQwZGQxOGVjMGIzY2JlZjVlYzM2NTZlYjFmOTRlZGU1MzY1MDFmM2U5ZDE1OTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.oZFmpEPZPAUCOlgRXHLH6oC9WDs39W_pHjcdfgJJFro" alt="Image" width="690" height="224"></a></p>
<p>So i inserted this block to <code>collate_fn</code> and saw multiple workers working.</p>
<pre data-code-wrap="python"><code class="lang-python">pid = os.getpid()
wid = torch.utils.data.get_worker_info().id
print(f"[PID={pid}/WID={wid}]")
</code></pre>
<p>Is this a bug in task manager, or is there more to it?</p>
Regarding ConvTranspose output_padding functionality

user8: <p>The docs for <a href="https://docs.pytorch.org/docs/stable/generated/torch.nn.ConvTranspose2d.html" rel="noopener nofollow ugc">ConvTranspose2d</a> state the following (emphasis mine):</p>
<blockquote>
<p>The padding argument effectively adds dilation * (kernel_size - 1) - padding amount of zero padding to both sizes of the input. This is set so that when a Conv2d and a ConvTranspose2d are initialized with same parameters, they are inverses of each other in regard to the input and output shapes. However, when stride &gt; 1, Conv2d maps multiple input shapes to the same output shape. output_padding is provided to resolve this ambiguity by effectively increasing the calculated output shape on one side. <strong>Note that output_padding is only used to find output shape, but does not actually add zero-padding to output.</strong></p>
</blockquote>
<p>This is similar for the 1d and the 3d variants.</p>
<p>I understood that the parameter is used to resolve output shape ambiguity. However, from what I gathered, specifying <code>output_padding</code> adjusts the shape by applying the convolution for additional steps at the “end“ of the input, on a 0-padded region. This effectively results in the output being padded with zeros.</p>
<p>1d example:</p>
<pre data-code-wrap="python"><code class="lang-python">inputs = torch.Tensor([[[1,2,3]]])
weights = torch.Tensor([[[1,1,1]]])
torch.nn.functional.conv_transpose1d(inputs, weights, padding=0, stride=3, dilation=1, output_padding=0)
# tensor([[[1., 1., 1., 2., 2., 2., 3., 3., 3.]]])
torch.nn.functional.conv_transpose1d(inputs, weights, padding=0, stride=3, dilation=1, output_padding=1)
# tensor([[[1., 1., 1., 2., 2., 2., 3., 3., 3., 0.]]])
torch.nn.functional.conv_transpose1d(inputs, weights, padding=0, stride=3, dilation=1, output_padding=2)
# tensor([[[1., 1., 1., 2., 2., 2., 3., 3., 3., 0., 0.]]])

</code></pre>
<p>Considering the documentation’s emphasis, I was wondering whether I missed anything regarding how the output padding works. <strong>Is it possible for output padding to produce non-zero padding in the output?</strong></p>
<p>Thank you for your support.</p>
No download option for histogram visualizations in TensorBoard (when using torch-pruning)

SadMoon: <p>When using the <code>torch-pruning</code> library with TensorBoard for histogram visualization, I noticed there’s <strong>no direct download option</strong> for histograms in the TensorBoard interface. Currently, I <strong>have to rely on taking screenshots</strong> to save these visualizations.<br>
Is there a built-in way to export/download histogram data from TensorBoard (e.g., as raw data or an image)? If not, could this be considered as a future feature?<img src="https://discuss.pytorch.org/images/emoji/apple/pleading_face.png?v=14" title=":pleading_face:" class="emoji" alt=":pleading_face:" loading="lazy" width="20" height="20"></p>
How are pretrained weights loaded in nn.LazyLinear layers

gk-mixar: <p>Hello in a project of mine I am trying to build a linear layer for which the input dim may change depending upon the dataset used.<br>
So I am using a nn.lazylinear.<br>
However after obtaining the stat_dict after training whenever I try to load the model using the state_dict I get issues with the keys :<br>
untimeError: Error(s) in loading state_dict for SeamModule:</p>
<pre><code>    Unexpected key(s) in state_dict: "model.enc_to_dec.weight", "model.enc_to_dec.bias". 
</code></pre>
<p>How do i properly load the trained Lazylinear weights ?</p>

ptrblck: <p>I’m unable to reproduce the issue by trying to load a <code>state_dict</code> into an uninitialized <code>Lazy*</code> model. Could you post a minimal code snippet to reproduce the issue, please?</p>
<p>Also, as a workaround you might need to perform the dry-run before loading the <code>state_dict</code> but it’s unclear to my if that’s indeed necessary as I don’t see any errors.</p>

gk-mixar: <p>Yes, i tried training a model again from scratch using nn.LazyLinear. It seems to work fine when I later load checkpoints.<br>
I guess the error was coming up from a different part of the code.<br>
Thanks for the prompt reply though !</p>
Question about torch._grouped_mm GPU support

StarrickLiu: <p>Hi PyTorch team,</p>
<p>I noticed that <code>torch._grouped_mm</code> in PyTorch 2.8 only supports GPUs with compute capability &gt;= SM90:</p>
<p><a href="https://github.com/pytorch/pytorch/blob/df6073641079c781e66a905e4f15ee49ac257eb2/aten/src/ATen/native/cuda/Blas.cpp#L1752" rel="noopener nofollow ugc">https://github.com/pytorch/pytorch/blob/df6073641079c781e66a905e4f15ee49ac257eb2/aten/src/ATen/native/cuda/Blas.cpp#L1752</a></p>
<p>This means it doesn’t work on older GPUs like V100 (SM70), A100 (SM80), or RTX 30 series (SM86).</p>
<p><strong>My questions:</strong></p>
<ol>
<li>
<p>Are there any plans to support grouped GEMM on GPUs with SM &lt; 90?</p>
</li>
<li>
<p>If not, would you accept a PR that adds this support? I’m willing to contribute this feature.</p>
</li>
</ol>
<p>Thanks!</p>