All Questions
Tagged with pytorch python-3.x
1,253 questions
0
votes
0
answers
92
views
Why does torch import complain about numpy version
I created a virtual environment on MacOS and installed pytorch with pip:
python -m env torch-env
source torch-env/bin/activate
pip install torch torchvision torchaudio
Launching python and importing ...
-1
votes
1
answer
123
views
Why isn't pip finding torch when installing on mac?
I've tried to use pip to install pytorch but it's saying it's not found.
Command I used: pip install torch
Context: I'm using MacOS 15.3.2; architecture arm64; python 3.13.2
Output from the command:
...
1
vote
1
answer
39
views
How to produce tensor of first occurrencies of another tensor using PyTorch
Let's say we have an ordered 1D tensor of ints/longs t.
I want to produce a new tensor a with size max(t) where each term a[i] contains the first occurrence of the value i in the tensor t.
We could ...
0
votes
0
answers
36
views
Python 3.9.20, PyTorch 2.5.0 (MacOS): Setting Seed Does Not Produce Deterministic Results
I am using the above versions, and a fully connected NN (snippets shown below). I have set the seeds for all associated random number modules, but I am still not receiving deterministic results.
I am ...
-4
votes
1
answer
5k
views
install pytorch for cuda 12.6
how to install pytorch for cuda 12.6? it is available till 12.4. but when I install 12.4, it installed. but it is showing kernel restarting issue in jupyter notebook. please help.
can you please ...
0
votes
0
answers
132
views
Training Freezes with Accelerate Library on Multi-GPU Setup
I’m encountering an issue when trying to run distributed training using the Accelerate library from Huggingface. The training process freezes after the dataloader initialization when using multiple ...
-1
votes
1
answer
95
views
Why there is 'Unpickling Error' when using polars to read data for pytorch?
I have changed my data tool from xarray to polars in recent, and use pl.DataFrame.to_torch() to generate tensor for training my Pytorch model. Data source's format is parquet file.
For avoiding fork ...
0
votes
1
answer
319
views
"NotImplementedError: Could not run 'aten::add.out' with arguments from the 'QuantizedCPU' backend" while implementing QAT on resnet18 using pytorch
I am trying to implement Quantization Aware Training(QAT) resnet18 model. While inferring I get this error
NotImplementedError: Could not run 'aten::add.out' with arguments from the 'QuantizedCPU' ...
0
votes
0
answers
22
views
How to modify batch data to reflect changes in original data in dataloader/pytorch?
I recently created a dataset class and am having trouble modifying the data in the batch so that it is reflected in future batches and original data
I have the following dataset class
class ...
1
vote
1
answer
538
views
What is the difference between various backends in torch.nn.attention.SDPBackend, and what do they mean?
In the pytorch docs on SDPBackend there are a few enums available to be used with the context manager,
ERROR: An error occurred when trying to determine the backend.
MATH: The math backend for scaled ...
0
votes
0
answers
13
views
i am trying to Run my code on PKU-MMD dataset but they give me this error
File "/public/usman/SCD-NET/feeder/augmentations.py", line 135, in temporal_cropresize
temporal_context=temporal_context.permute(0, 2, 3, 1).contiguous().view(C * V * M,temporal_crop_length)
...
0
votes
1
answer
109
views
How to implement a custom loss function (NCD) in pytorch?
I would like to implement a custom loss function known as Normalised Compression Distance or more commonly NCD for short. I am not quite sure how to approach this.
Could someone explain and give an ...
0
votes
0
answers
201
views
Cuda failure ‘named symbol not found’ when run on 4 L4 GPUs
Can someone help me with the following error. The code works fine on the 2 T4 GPUs. But fails when run on the 4 L4 GPUs. I am extending the Gemma 2B model for a multi-label multi-class classification ...
1
vote
0
answers
33
views
How to display meaningful names for intermediate operations in PyTorch computational graph visualization?
I'm trying to visualize the computational graph of my PyTorch model using torchviz. I want the nodes in the graph to display meaningful names for the intermediate computations. However, the graph only ...
5
votes
2
answers
5k
views
TypeError: expected np.ndarray (got numpy.ndarray)
I use the below code and it report error, This is a very simple example and should not report error as expected.
import numpy as np
import torch as th
# Assuming tt is some data (example as list)
tt =...