Questions tagged [pytorch]

For conceptual questions that somehow involve the PyTorch library, but note that programming questions are off-topic here.

Filter by
Sorted by
Tagged with
7
votes
1answer
156 views

When should you not use the bias in a layer?

I'm not really that experienced with deep learning, and I've been looking at research code (mostly PyTorch) for deep neural networks, specifically GANs, and, in many cases, I see the authors setting <...
7
votes
1answer
3k views

Can neural networks be evolved using NEAT in TensorFlow? [closed]

I am making a machine learning program for time series data analysis, and using NEAT could help the work. I started to learn TensorFlow not long ago, but it seems that the computational graphs in ...
6
votes
1answer
776 views

Is there ever a need to combine deep learning frameworks? (Eg. TensorFlow & Torch)?

Imagine a simple scenario of having a large repository using one framework and integrated with data/robots, etc., then having a new feature requested and the framework missing some vital functionality ...
5
votes
1answer
190 views

Is there a reason to use TensorFlow over PyTorch for research purposes?

I've been using PyTorch to do research for a while and it seems to be quite easy to implement new things with. Also, it is easy to learn and I didn't have any problem with following other researchers ...
4
votes
1answer
118 views

What are the differences between TensorFlow and PyTorch? [closed]

What are the differences between TensorFlow and PyTorch, both in terms of performance and functionality?
3
votes
2answers
100 views

Is there any difference between affine transformation and linear transformation?

Consider the following statements from A Simple Custom Module of PyTorch's documentation To get started, let’s look at a simpler, custom version of PyTorch’s Linear module. This module applies an ...
3
votes
1answer
85 views

How to incorporate a symmetry constraint in the loss function to train a CNN?

I have a task of extremely sparse binary segmentation, i.e. the segmentation mask contains either 0 or 1, and there are ~95% zeros and only ~5% ones. I use the focal loss to address the sparseness (...
3
votes
1answer
105 views

Training network with 4 GPUs performance is not exactly 4 times over one GPU why? [closed]

Training neural network with 4 GPUs using pyTorch, performance is not even 2 times (btw 1 & 2 times) compare to using one GPU. From Nvidia-smi we see GPU usage is for few milliseconds and next 5-...
3
votes
1answer
1k views

Are the training loss and validation loss plotted per sample or per batch?

I am using a CNN to train on some data, where training size = 21700 samples, and test size is 653 samples, and say I am using a batch_size of 500 (I am accounting for samples out of batch size as well)...
3
votes
1answer
77 views

Mnist CNN Architecture

In this tutorial from Jeremy Howard: What is torch.nn really? he has an example towards the end where he creates a CNN for mnist. In nn.Conv2d he makes the ...
3
votes
1answer
99 views

Issue at training simple RNN for word generation

After completing Coursera course from Andrew Ng, I wanted to implement again simple RNN for generating dinosaurs name based on a text file containing around 800 dinosaurs name. This is done with ...
2
votes
1answer
69 views

Can TensorFlow, PyTorch, and other mainstream ML frameworks be used for research-grade work in AI?

Many authors of research papers in AI (e.g. arXiv) write their neural networks from the ground-up, using low-level languages like C++ to implement their theories. Can existing open source frameworks ...
2
votes
2answers
186 views

Advantage computed the wrong way?

Here is the code written by Maxim Lapan. I am reading his book (Deep Reinforcement Learning Hands-on). I have seen a line in his code which is really weird. In the accumulation of the policy gradient $...
2
votes
1answer
101 views

Policy Gradient on Tic-Tac-Toe not working

I wanted to implement the Policy Gradient on Tic-Tac-Toe. I tried to use the code that worked for any environment like CartPole-v0 to my Tic-Tac-To game. But it is not learning. There are no errors. ...
2
votes
1answer
655 views

Why isn't my implementation of A2C for the the atari pong game converging?

I have two different implementations with PyTorch of the Atari Pong game using A2C algorithm. Both implementations are similar, but some portion are different. https://colab.research.google.com/drive/...
2
votes
1answer
302 views

Heavy loss and inaccurate answer in pytorch

As my first AI model I have decided to make an AI model to predict multiplication of two numbers EX - [2,4] = [8]. I wrote the following code, but the loss is very high, around thousands, and it's ...
2
votes
1answer
50 views

Is it possible to train one part of the network with a particular learning rate and the other part with a different one?

I have a combined network consisting of two parts: one is for images and the other is for numerical data. Each sample is matched with a numerical case by an ID. For this combined network, a ...
2
votes
3answers
75 views

DQN not learning and step not stepping towards target

I am trying to create a simple Deep Q-Network with 2d convolutional layers. I can't figure out what I am doing wrong, and the only thing I can see that doesn't seem right is when I get the model ...
2
votes
1answer
119 views

How to add some data input in a CNN?

There is this problem I have encountered, I was trying to classify the pixels from input image into classes, sort of like segmentation, using a encoder-decoder CNN. The “interested” pixels usually ...
2
votes
1answer
1k views

How to export Pytorch Deep Neural Networks trained model to C++ program to use it from C++? [closed]

I want to build a DNN model that I will later integrate into a C++ program. I heard that PyTorch model is hard to load it on C++ and the integration requires extra code, and it's complicated. I have ...
2
votes
2answers
523 views

Why isn't my model learning satisfactorily?

The problem to solve is non-linear regression of a non-linear function. My actual problem is to model the function "find the max over many quadratic forms": ...
2
votes
0answers
23 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
0answers
56 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
1answer
92 views

What is the difference between FC and MLP in as used in PointNet?

I am trying to understand the PointNet network for dealing with point clouds and struggling with understanding the difference between FC and MLP: "FC is fully connected layer operating on each ...
2
votes
0answers
92 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
0answers
149 views

What is the equivalent PyTorch version of tensorflow lite

Update Checked the PyTorch Mobile which is designed to Android and iOS. Although according to the document, it says it can build for ARM CPUs, but there isn't any documentation mention about how to ...
2
votes
0answers
66 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
0answers
422 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 ...
2
votes
0answers
1k views

How to transfer learn Darknet YOLOv3

I've started getting into object detection in image. I have YOLOv3 neural network with Darknet framework. The network is pre-trained from COCO data set. Now I need to do some transfer learning in ...
1
vote
1answer
63 views

What exactly is an XPU?

I know about CPU, GPU and TPU. But, it is the first time for me to read about XPU from PyTorch documentation about MODULE. ...
1
vote
1answer
32 views

Is there any recommended way to perform pooling in this context?

Suppose I have three batches of feature maps, each of size $180 \times 100 \times 100$. I want to concatenate all these feature maps channel-wise, and then resize them into a single feature map. The ...
1
vote
1answer
102 views

What exactly happens in gradient clipping by norm?

Consider the following description regarding gradient clipping in PyTorch ...
1
vote
1answer
34 views

What does 'input planes' mean in the phrase 'input signal/image composed of several input planes'?

PyTorch documentation provided the following descriptions to the Convolution layers ...
1
vote
1answer
41 views

What does it mean by "zeros the networks parameters gradients" in the context of training a neural network?

Consider the following PyTorch code ...
1
vote
1answer
73 views

Why is the policy loss the mean of $-Q(s, \mu(s))$ in the DDPG algorithm?

I am trying to implement the DDPG algorithm based on this paper. The part that confuses me is the actor network's update. I don't understand why the policy loss is simply the mean of $-Q(s, \mu(s))$, ...
1
vote
1answer
194 views

How does the policy gradient's derivative work?

I am trying to understand the policy gradient method using a PyTorch implementation and this tutorial. My first question is about the end result of this gradient derivation, \begin{aligned} \nabla \...
1
vote
1answer
34 views

Is this calculation of the vector-Jacobian product in the PyTorch documention wrong?

In the official PyTorch documentation there is the following calculation (here): $$ J^{T} \cdot \vec{v}=\left(\begin{array}{ccc} \frac{\partial y_{1}}{\partial x_{1}} & \cdots & \frac{\partial ...
1
vote
1answer
28 views

Are there any stats available on the usage of libraries by deep learning researchers?

I know three Python libraries that are popular in deep learning research community: Keras, PyTorch, Tensorflow. I don't know much about Theano. This question is not about the efficiency, flexibility ...
1
vote
1answer
578 views

In PyTorch, why does the sequence length need to be provided as the first dimension of the input tensor for an RNN?

I am confused as to why the sequence length is the first dimension of the input tensor for an RNN, while the batch size is the first dimension for any other kind of network (linear, CNN, etc.). This ...
1
vote
1answer
110 views

What does the notation $\partial \theta_{\pi}$ mean in this actor-critic update rule?

One of the steps in the actor-critic algorithm is $$\partial \theta_{\pi} \gets \partial \theta_{\pi} + \nabla_{\theta}\log\pi_{\theta} (a_i | s_i) (R - V_{\theta}(s_i))$$ For me, $\theta$ are just ...
1
vote
1answer
138 views

Why are the rewards of my RL agent for the Atari Breakout game decreasing after a certain number of episodes?

The agent is trying to master the Atari Breakout game. Here is my code Is that normal that reward_100 decreased that much after it hits 4.5? Is there a way to ...
1
vote
1answer
140 views

Is this learning rate schedule increasing the learning rate?

I was reading a PyTorch code then I saw this learning rate scheduler: ...
1
vote
1answer
419 views

LSTM is not converging

I am writing my first LSTM network and I would really appreciate if someone can tell me if it is right (the loss seems to go down very slowly and before playing around with hyper parameters I want to ...
1
vote
1answer
56 views

PyTorch `torch.no_grad` vs `torch.inference_mode` [closed]

PyTorch has new functionality torch.inference_mode as of v1.9 which is "analogous to torch.no_grad... Code run under this ...
1
vote
0answers
26 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
0answers
16 views

Non-determinism with mixed precision?

Currently, we're trying to improve failure analysis capability when using neural nets. One thing we want to resolve is output variation between batched runs and non-batched runs. For example, we wrote ...
1
vote
0answers
17 views

What is an "additional channel dimension" contain in batch normalization?

Consider the following explanations regarding a batch normalization layers in PyTorch #1: one dimensional batch normalization class torch.nn.BatchNorm1d(.........) Applies Batch Normalization over a ...
1
vote
0answers
46 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
0answers
67 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 ...
1
vote
0answers
29 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 ...