Questions tagged [pytorch]
For conceptual questions that somehow involve the PyTorch library, but note that programming questions are off-topic here.
97
questions with no upvoted or accepted answers
3
votes
0
answers
71
views
How are partial derivatives calculated in a computational graph?
I am trying to understand how are partial derivatives calculated in a computational graph. I understand reasoning behind computational graphs and I am bold enough to say I understand how they work, at ...
3
votes
0
answers
2k
views
What is the fundamental difference between max pooling and adaptive max pooling used in PyTorch
PyTorch provides max pooling and adaptive max pooling.
Both, max pooling and adaptive max pooling, is defined in three dimensions: 1d, 2d and 3d. For simplicity, I am discussing about 1d in this ...
2
votes
0
answers
130
views
Reverse Process in Diffusion Model Doesn't Return Original Image
I am attempting to program a Denoising Diffusion Model based on the one introduced in the article by Ho et al. (2020). However, I have run into issues while testing the reverse diffusion process.
...
2
votes
0
answers
27
views
How to create a loss function that penalizes duplicate indices in the output tensor?
We're working on a sequence-to-sequence problem using pytorch, and are using cross-entropy to calculate the loss when comparing the output sequence to the target sequence. This works fine and ...
2
votes
0
answers
200
views
What is an "additional channel dimension" contain in batch normalization?
Consider the following explanations regarding batch normalization layers in PyTorch
#1: one dimensional batch normalization
class torch.nn.BatchNorm1d(.........)
Applies Batch Normalization over a 2D ...
2
votes
0
answers
436
views
Positional Encoding in Transformer on multi-variate time series data hurts performance
I set up a transformer model that embeds positional encodings in the encoder. The data is multi-variate time series-based data.
As I just experiment with the positional encoding portion of the code I ...
2
votes
0
answers
27
views
Is there any closed form analytical expression to represent fractional max pooling?
There are Nineteen types of pooling layers in PyTorch.
Almost all of the layers are provided with corresponding analytical formulae. But analytical formulae are not provided for the fractional max-...
2
votes
0
answers
274
views
Is there any animation that illustrates the "fold" and "unfold" operations of convolutional layers?
There are fourteen convolution layers in PyTorch. Among them six are related to convolution, another six are related to transposed convolution. The remaining two are fold and unfold operations.
The ...
2
votes
0
answers
176
views
How will the filter size affect the transpose convolution operation?
After a series of convolutions, I am up-sampling a compressed representation, I was curious what is the methodology I should follow to choose an optimum kernel size for up-sampling.
How will the ...
2
votes
0
answers
180
views
Why does GAN loss converge to log(2) and not -log(2)?
In Goodfellow's paper, he says:
Hence, by inspecting Eq. 4 at $D^*_G (\mathbf{x}) = \frac{1}{2}$, we find $C(G) = \log \frac{1}{2}+ \log \frac{1}{2} = − \log 4$. To see that this is the best ...
2
votes
0
answers
85
views
Why does the BatchNormalization layer produce different outputs during training and inference?
I modified resnet50 architecture to get a regression network. I just add batchnorm1d and ReLU layers just before the fully connected layer. During the training, the output of batchnorm1d layer is ...
2
votes
0
answers
697
views
How can I train YOLO with the COCO dataset?
I am trying to implement the original YOLO architecture for object detection, but I am using the COCO dataset. However, I am a bit confused about the image sizes of COCO. The original YOLO was trained ...
1
vote
0
answers
33
views
How can an MLP be implemented with convolutional layers?
I am studying the architecture of the network pointnet, specifically the MLPs stages of the pipeline highlighted in red in the following image (taken from the author page here):
It is strange to find ...
1
vote
0
answers
29
views
Why would increasing layers in PyTorch Transformer significantly increase loss?
I have a simple torch.nn.Transformer module for machine translation on the Multi30k dataset. It performs pretty well (32.2 Bleu score) but I looked at scaling up ...
1
vote
0
answers
21
views
dropout as the final layer or in every layer to avoid underfitting/overfitting
I am training a Dense neural network where I am having input as a 3x3 matrix, and predicting the eigenvalues of that matrix. Initially, I was having num_samples = 2000, so my model was not able to ...
1
vote
0
answers
33
views
Periodical fluctuations in loss curves
I am training a neural network (specifically a GRU based architecture but I think this is not too relevant for the question). My loss curves, especially the training loss but also the validation loss, ...
1
vote
0
answers
134
views
What is wrong with my PyTorch model training on CIFAR10?
I am training a ResNet model on CIFAR10 dataset. For the training subset, I selected a random 1% of the train data from the default train/test split. For the test subset I used the whole default test ...
1
vote
0
answers
115
views
Higher validation loss after using Dropout
I’m working on a classification problem (500 classes). My NN has 3 fully connected layers, followed by an LSTM layer. I use nn.CrossEntropyLoss() as my loss ...
1
vote
0
answers
226
views
Where can I get Imagenet test dataset labels for evaluation
I have the imagenet train, validation and test set. I have been able to assign each image in the validation set into its respective class folders with the help of some online resources. However, for ...
1
vote
0
answers
156
views
How can I produce crossbred images out of two datasets?
I'm very new to AI and deep learning. So my question is going to be very basic.
I'm trying to understand which approach I would need to use to cross-breed set of images. Let's say I'm having dataset ...
1
vote
0
answers
138
views
How to compute the loss for a sequence labeling task without the Softmax distribution?
For a sequence labeling task (NER), we compute the loss by passing the softmax distribution of the classes (e.g. vocabulary) with the gold label to the loss function (...
1
vote
1
answer
322
views
Multi label classification on non binary labels with pytorch
I am working on a project consisting of medical images and a huge dataset of multi-label and non-binary labels/outcomes ( sex, blood pressure, age and 40 more ).
Would be the best approach to hard ...
1
vote
0
answers
79
views
Are there any benefits of adding attention to linear layers?
Is attention useful only in transformer/convolution layers? Can I add it to linear layers? If yes, how (on a conceptual level, not necessarily the code to implement the layers)?
1
vote
1
answer
2k
views
Deep Q-Learning with multiple discrete actions
I am working on a DQN project with Pytorch, where I should choose multiple discrete actions, each in a range, say, (0, 15). I am wondering how I can model it, such ...
1
vote
0
answers
72
views
Batch normalization for multiple datasets?
I am working on a task of generating synthetic data to help the training of my model. This means that the training is performed on synthetic + real data, and tested on real data.
I was told that batch ...
1
vote
0
answers
471
views
Is there any gain by lazy initialization of weights, biases and number of input channels for a convolution operation?
The basic layers for performing convolution operations 1,2,3 in PyTorch are
...
1
vote
3
answers
143
views
How can I model any structure for a neural network?
Hello I am currently doing research on the effect of altering a neural network's structure. Particularly I am investigating what affect would putting a random DAG (directed acyclic graph) in the ...
1
vote
0
answers
59
views
What's the best way to take a list of lists as DQN input?
I have my own environment for the DQN algorithm. In my environment, the state space is represented by a list of lists, where each sublist can be of different lengths. In my case, the length of the ...
1
vote
0
answers
521
views
Why does the VAE using a KL-divergence with a non-standard mean does not produce good images?
I know I can make a VAE do generation with a mean of 0 and std-dev of 1.
I tested it with the following loss function:
...
1
vote
0
answers
215
views
variational auto encoder loss goes down but does not reconstruct input. out of debugging ideas
My variational autoencoder seems to work for MNIST, but fails on slightly "harder" data.
By "fails" I mean there are at least two apparent problems:
Very poor reconstruction, for ...
1
vote
0
answers
35
views
is it ok to take random actions while training a3c as in below code
i am trying to train an A3C algorithm but I am getting same output in the multinomial function.
can I train the A3C with random actions as in below code.
can someone expert comment.
...
1
vote
0
answers
96
views
Is it good practice to save NLP Transformer based pre-trained models into file system in production environment
I have developed a multi label classifier using BERT. I'm leveraging Hugging Face Pytorch implementation for transformers.
I have saved the pretrained model into the file directory in dev environment. ...
1
vote
0
answers
365
views
Classification or regression for deep Q learning
DQN implemented at https://github.com/PacktPublishing/PyTorch-1.x-Reinforcement-Learning-Cookbook/blob/master/Chapter07/chapter7/dqn.py uses the mean square error loss function for the neural network ...
1
vote
0
answers
76
views
In layman's terms, what is stochastic computation graph?
I'm going through the distributions package on PyTorch's documentation and came across the term stochastic computation graph. In layman's terms, what is it?
1
vote
0
answers
81
views
Benchmarking SAC on Pybullet
So far I have seen TD3 and DDPG benchmarks on Pybullet environments, but I am looking for SAC benchmarks on Pybullet too, anyone can help?
1
vote
0
answers
215
views
How can I use GPT-2 to modify seed text of one form into a different form (LENGTH INVARIANT) whilst retaining meaning?
I am currently starting a research project whereby I am trying to convert text of one form into another.
i.e. If I were to write a seed sentance of the form "Scientists have finally achieved the ...
1
vote
0
answers
341
views
Replace epsilon greedy action selection and the standard DQN by an Independent Gaussian Noise Network Model
Here is my code
Recently, I solved the game of Atari Breakout using a classic DQN model. The convergence of the mean reward slowly improved during three days. I was interested in learning a method ...
1
vote
0
answers
202
views
Is it possible to do token classification using a model such as GPT-2?
I am trying to use PyTorch's transformers as a part of a research project to do sentiment analysis of several types of review data (laptop and restaurant).
To do this, my team is taking a token-...
1
vote
1
answer
103
views
time-series prediction : loss going down, then stagnates with very high variance
I am trying to design a model based on LSTM cells to do time-series prediction. The ouput value is an integer in [0,13]. I have noticed that one-hot encoding it and ...
1
vote
2
answers
273
views
RealNVP gives wrong probabilities
I am trying to use RealNVP with some data I have (the input size is a 1D vector of size 22). Here is the link to the RealNVP paper and here is a nice, short explanation of it (the paper is pretty long)...
1
vote
0
answers
178
views
Why is my variational auto-encoder generating random noise?
This is my first variational autoencoder. Background info: I am using the MNIST digits dataset. The model is created and trained in PyTorch. The model is able to get a reasonably low loss, but the ...
1
vote
0
answers
28
views
How can I train a neural network to find the hyper-parameters with which the data was generated?
I have 10000 tuples of numbers (x1, x2, y) generated from the equation: y = np.cos(0.583 * x1) + np.exp(0.112 * x2). I want to ...
1
vote
0
answers
81
views
Why are the current means and the old ones the same in this implementation of Elastic Weight Consolidation?
I'm trying to re-implement Elastic Weight Consolidation (EWC) as outlined in this paper. As a reference, I am also using this Github repository (another implementation).
My model/idea is pretty ...
1
vote
0
answers
23
views
Can Grad CAM feature maps be used for Training?
I am trying to recreate the architecture of the following paper: https://arxiv.org/pdf/1807.03058.pdf
Can someone help me in explaining how are the feature maps coming out of the output of GradCam ...
1
vote
0
answers
215
views
Super Resolution CNN generates black dots on output images
I have been trying to train a CNN for the super-resolution task based on the work of Dong et al., 2015 [1]. The network structure built in PyTorch is as follows:
...
1
vote
0
answers
20
views
Limits for a bottleneck
I have some 64x64 pixels frames from a (simulated) video, with a spaceship moving on a fixed background. The spaceship moves in a straight line with constant velocity from left to right (along the x-...
1
vote
1
answer
388
views
How to properly optimize shared network between actor and critic?
I'm building an actor-critic reinforcment learning algorithm to solve environments. I want to use a single encoder to find representation of my environment.
When I share the encoder with the actor ...
1
vote
0
answers
116
views
How to make episode ending "good" in reinforcement learning?
TL;DR: read the bold. The rest are details
I am trying to implement Reinforcement Learning:An Introduction, section 13.5 myself:
on OpenAi's cartpole
The algorithm seems to be learning something ...
0
votes
0
answers
10
views
How to Change the Length of a Sequence Using Linear Projection In PyTorch?
I was trying to reproduce a voice conversion model using PyTorch and I had difficulty implementing a module called PBTC (Parallel Bank of Transposed Convlutions), used in https://arxiv.org/pdf/2303....
0
votes
0
answers
11
views
Not pre-trained binary transformer model
I stacked with a problem. My default Transformer model totally does not learn how to evaluate python logical expressions, like: '(False and not True) xor False or (not False and False)'. Model should ...