All Questions
Tagged with performance pytorch
89
questions
0
votes
0
answers
71
views
Keras training speed with PyTorch backend is a lot slower than with TensorFlow
I am on native Windows and I used old Keras with TensorFlow 2.10 (GPU accelerated) before. I wanted to try Keras 3 with PyTorch backend.
Can someone please help me why this model trains 10x slower ...
0
votes
0
answers
59
views
What is the most accurate way of computing the evaluation time of a neural network model?
I am training some neural networks in pytorch to use as an embedded surrogate model. Since I am testing various architectures, I want to compare the accuracy of each one, but I am also interested in ...
0
votes
1
answer
30
views
Is there any way to replace integers with tensors in torch?
Say I have
a = torch.tensor([[1,2,3],[2,1,3]])
And i want to replace integers 1,2,3 with [1,2,3],[4,5,6],[7,8,9] respectively.
Meaning,
i want
result = torch.tensor([[1,2,3,4,5,6,7,8,9],[4,5,6,1,2,3,7,...
0
votes
0
answers
59
views
Understanding pytorch performance
I am running code to pass an input image (as pytorch tensor) through a convolutional network (torchvision.models.segmentation.deeplabv3_mobilenet_v3_large() with a modified head). On the returned ...
0
votes
0
answers
19
views
Model-based reinforcement learning code training is too slow, only 3 epochs (3000 steps) in 12 hours
I am a researcher of model-based reinforcement learning. I added the Normalizing flow model to my code to obtain better simulation samples through the flow. I integrated and debugged the two parts for ...
0
votes
2
answers
718
views
Is there a way to share a PyTorch model across multiple processes without using multiple copies?
I have a custom PyTorch model that bottlenecks my application due to how it is currently used.
The application is a web server built in Flask that receives job submissions for the PyTorch model to ...
1
vote
1
answer
51
views
PyTorch tensor.sum() performance drops with large tensors vs. NumPy
tensor.sum() performance drops once my tensor exceeds a certain size. Why is that?
import torch
tensor = torch.FloatTensor(200_000, 2_000).uniform_() > 0.8 # random 1's and 0's
tensor[:, :1000]....
0
votes
0
answers
39
views
Unable to get Apple Neural Engine to run inference on model
I am unable to get the Apple Neural Engine (ANE) to run the DenseNet121 model after fine-tuning it using PyTorch. When downloading the model directly from torchvision with retrained weights, it ...
0
votes
2
answers
91
views
Getting no grad set error in pytorch while traning
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
i'm getting this error with the following training loop, the grads must have been set by the sequential itself, ...
0
votes
0
answers
74
views
Pytorch split Tensor when consecutive zeros
I am attempting to segment a 1D pytorch tensor each time when a sequence of x consecutive zeros is encountered. If additional zero elements follow this 'split,' I intend to remove them until the next ...
0
votes
0
answers
66
views
Keras 5x faster than Pytorch in basic example
I noticed a big difference in training time for a Keras example and the equivalent Pytorch code, taking this last 5x as much time as Keras. In fact, the DataLoader alone takes more time than Keras. I'...
0
votes
0
answers
50
views
Python code is taking too long for conversion of adjacency list to matrix and vice versa
I am working with the Reddit dataset and to train my graph ML model. I need to create a train adjacency matrix from the provided full graph adjacency list. The process involves converting the ...
1
vote
2
answers
385
views
PyTorch autograd: Efficient computation of Jacobian and Jacobian-Vector-product of scalar function over range of inputs
I have function which takes 5 values as arguments and returns a scalar. That is a mapping of the form f:R^5 -> R.
Hench, its Jacobian J is a matrix with dimension (1x5) and might as well have been ...
0
votes
1
answer
362
views
PyTorch: nn.Identity() vs. lambda x: x : Can they be used interchangeably?
Can I use a lambda function, lambda x: x instead of torch.nn.Identity? And does this differ depending on where in a model this identity is placed? My guess would be that pytorch might not know how to ...
0
votes
0
answers
82
views
PyTorch) How to improve the inference speed in this case?
Can you tell me how to improve the inference speed in this case?
W = torch.rand(768, 768)
X = torch.rand(128, 128, 768)
I want to use only the 2nd and 4th quadrants of W for matrix multiplication.
(...