Questions tagged [pytorch]
PyTorch is a deep learning framework that implements a dynamic computational graph, which allows you to change the way your neural network behaves on the fly and capable of performing backward automatic differentiation.
27 questions
0
votes
1
answer
56
views
I have a pytorch module that takes in some parameters and predicts the difference between one of it inputs and the target
One instance of the following module uses up to almost 75% of my vram. So, I was wondering how I could improve that without slowing down runtime too much. The code is below:
...
3
votes
2
answers
80
views
Video Frame-by-Frame Deraining with MFDNet
After checking the repository of MFDNet, single image rain streaks removal with the provided model is given in test.py. I am trying to modify the code to process frame-by-frame rain streaks removal in ...
3
votes
0
answers
60
views
Transformer based on pytorch nn.Transformer to predict protein secondary structure
I'm working on a transformer as my final project in high school. Since I'm kinda new to ML (3 months of experience) I need someone to check my implementation, if I made any mistakes or bugs that I ...
5
votes
1
answer
154
views
3
votes
1
answer
97
views
Pytorch code running slow for Deep Q learning (Reinforcement Learning)
I'm a new student in reinforcement learning. Below is the code that I wrote for deep Q learning:
...
2
votes
1
answer
42
views
One-layer linear neural network to solve a regression problem in PyTorch
Good morning everyone,
I am trying to figure out how deep learning works. My approach is mainly theoretical but I have decided to code a few deep learning projects to get a better feel of the kind of ...
1
vote
0
answers
67
views
Convolution to reduce popcorn noise in black and white video
I have a black & white video as a tensor with the shape [Time, Width, Height] with popcorn noise and I would like to reduce the noise by naively convolving along the time dimension.
Using a ...
3
votes
1
answer
94
views
Randomly rotate an image through right angles
I'm new to Python, and coming from Typescript, I tried to include types, but it's not obvious sometimes.
Currently this is the way I type objects:
Write own simple types
Import type from a library ...
0
votes
0
answers
55
views
Exctracting features from each frame of a video and stacking all the frames' features at the end
I am working with videos. So, the input of my model has the shape of [batch_size,channels,frames,height,width]. So, my goal is to extract the the features from each frame separately using ResNet2D and ...
1
vote
0
answers
107
views
Storing multiple PyTorch tensors of different shapes with names that are not known by advance
I need to create a container for instances of torch.Tensor of different shapes, where I can call them by their name.
It is a use case for a dict except that:
I don't want to rely on the heavy syntax ...
2
votes
0
answers
88
views
neural network that determines the gender of a word
I wrote a neural network in python using pytorch, which determines the gender of a word in Russian. As a training set: a file containing a word and a number from 0 to 2 (0-masculine,1- feminine and 2-...
2
votes
0
answers
95
views
Higher order derivatives with functorch
I'm computing higher order derivatives using nested jacobian from pytorch/functorch.
$$f(x, y, z, \dots) : R^{m_x} \times R^{m_y}...
1
vote
0
answers
160
views
Binary classification with pytorch
I wrote a simple neural network binary classification algorithm using Pytorch. It uses the dataset from https://www.kaggle.com/pritsheta/heart-attack, which consists of a table with 300 rows and 14 ...
1
vote
1
answer
645
views
Set min value of each row of a tensor to zero without using explicit loops
Here's the problem.
Return a copy of x, where the minimum value along each row has been
set to 0.
For example, if x is:
...
2
votes
1
answer
101
views
Loss function in python is a bit cumbersome
Here is a python function I have for a neural network I have implemented. I feel it become a bit cumbersome. The intention is to weight positive labels in channels ...
1
vote
0
answers
55
views
resnet with pytorch
I was studying resnet and wanted to program it with pytorch
I searched for some examples(github, google) but it was hard to understand the code completely
So I programmed resnet myself and it works.
...
1
vote
0
answers
82
views
Complex division for imaginary part
I seek a fast implementation of (x / y).imag, where x, y are complex 2D arrays (PyTorch tensors already on GPU). My approach is ...
7
votes
1
answer
116
views
A .py utility file for neural network learing rate policies
I've created a .py utility file, which specifies the learning rate policy for the neural network in PyTorch. The program in prior reads a ...
2
votes
0
answers
276
views
Computing inverse of modified matrix using Sherman-Morrison formula
I have the following implementation that takes in symmetric matrix W and returns matrix C
...
4
votes
1
answer
301
views
increase efficiency of loops and element-wise operations in PyTorch implementation
For any input symmetric matrix with zero diagonals W, I have the following implementation in PyTorch. I was wondering if the ...
2
votes
0
answers
27
views
Enhancing performance using DataParallel
I have written the following code to practice parallelizing a PyTorch code on GPUs:
...
3
votes
0
answers
65
views
Batch normalization code optimization?
I am trying to implement Deep Quaternion Networks. I was able to implement the batch normalization technique. But it requires a lot of GPU memory. Is there any way I can optimize the code provided ...
2
votes
1
answer
3k
views
Loops in PyTorch Implementation
I'm trying to implement a regularization term for the loss function of a neural network.
...
4
votes
2
answers
1k
views
PyTorch Vectorized Implementation for Thresholding and Computing Jaccard Index
I have been trying to optimize a code snippet which finds the optimal threshold value in a n_patch * 256 * 256 probability map to get the highest Jaccard index ...
2
votes
0
answers
141
views
GRU-Autoencoder training
I'm training a GRU auto-encoder and my current code is very slow.I believe it's predict_captions function that takes most the time. Any suggestion to optimize this code?
...
5
votes
1
answer
3k
views
PyTorch Unit-testing in Python
I'm new to PyTorch and I'm writing a unit test for an activation function I'm making.
I plan to test against a reference implementation for this function. I want to approach this in a test-driven way,...
20
votes
2
answers
13k
views
Intersection over Union for rotated rectangles
Problem Statement
I am trying to find the intersection over union (IoU) metric for one to several rotated rectangles compared to many different rotated rectangles. Here are some images to help ...