Questions tagged [pytorch]

Pytorch is an open source library for Tensors and Dynamic neural networks in Python with strong GPU acceleration. For details, see https://pytorch.org.

Filter by
Sorted by
Tagged with
0
votes
1answer
12 views

How is loss computed for multiclass CNN with an output layer larger than the number of classes?

I have built a CNN in pytorch for classifying the Fashion-MNIST dataset (10 classes). The images are 28x28. I have constructed the final layer in my model as an output of 50. (i.e. $nn.Linear(...
0
votes
1answer
11 views

How to handle different categorical embedding sizes in hold out data set

I have a pytorch tabular dataset with zip code as a categorical embedding. I'm getting great results on the test set. When I go to run my hold out sample through, it errors out because I have more ...
0
votes
0answers
6 views

Slow inference speed on pytorch Object detection

Recently I was experimenting with different object detection techniques faster than mobilnet SSD v1 tensorflow api. I came across similar implementation in pytorch. But while execution I found that ...
-1
votes
1answer
14 views

What does the collate function in pytorch (geometric)?

I am creating a message passing neural network and have some issues with the dataset creation. In pytorch (geometric) it is recommended to create a dataset with the following class. I wonder what is ...
0
votes
0answers
13 views

IndexError: index 3 is out of bounds for dimension 0 with size 3 #1 [closed]

I using pytorch . i Working on custom image detection with yolo using pytorch. I do transfer learning. While training i faces the error "index 3 is out of bounds for dimension 0 with size 3 #1" i do ...
0
votes
0answers
32 views

Pytorch CrossEntropyLoss expected long but got float

have you done some research before asking the question? Yes. I have done a lot of online searching, and others had similar problems. There solution was to use .float() when entering into the loss ...
0
votes
1answer
31 views

Tutorial for restricted Boltzmann machine using PyTorch or Tensorflow?

I am trying to find a tutorial on training Restricted Boltzmann machines on some dataset (e.g. MNIST), using either PyTorch or Tensorflow. The few I found are outdated. Can you recommend any?
1
vote
0answers
14 views

Using a DCGAN to create an intrusion detection system

The TL;DR of my question is how do you write a discriminator and generator of a DCGAN in pytorch to accept a csv file instead of an image? I am attempting to partial recreate an experiment from the ...
0
votes
1answer
37 views
+50

Fastest batch perspective transform for image augmentation

I need to do some augmentation for my training images for a neural networks. The problem is that even when loading batches in parallel, the augmentation is taking longer to perform than the network ...
0
votes
1answer
12 views

Why the first prediction of neural network in PyTorch is slower than following predictions?

So I have ResNet50 trained to classify images. For each prediction I track the time needed for it (input and model are moved to GPU): ...
0
votes
0answers
39 views

Adapting Pytorch tutorial “NMT from Scratch…” for dynamic RNN

I have taken the code from the tutorial and attempted to modify it to include bi-directionality and any arbitrary numbers of layers for GRU. Link to the tutorial which uses uni-directional, single ...
0
votes
0answers
20 views

Regression Task - Spark, PyTorch, TensorFlow or scikit

I know it's a broad question, sorry for that, but I'm still testing the waters with machine learning. I have a typical regression task (predict target numbers with the help of features x,y,z) and a ...
-1
votes
1answer
38 views

Softmax gives output vector whose sum is greater than 1 in Pytorch

I am a newbie to PyTorch. I was trying out the following network architecture to train a multi-class classifier. I used Softmax at the output layer and cross entropy as the loss function. However, the ...
-1
votes
0answers
27 views

Python Neural Network choose correct text

Hey I am new into the neural network scene. I would like to create a network which takes as input several file names. To train it I would say which files are usable and which are not. For example: ...
0
votes
1answer
50 views

BERT - How Question answering is different than classification

Basically I am trying to understand how question answering works in case of BERT. Code for both classes QuestionAnswering and Classification is pasted below for reference. My understanding is: <...
0
votes
1answer
127 views

How to get sentence embedding using BERT?

How to get sentence embedding using BERT? ...
0
votes
0answers
7 views

How do I augment data after spliting traininng datset into train and validation set for CIFAR10 using PyTorch?

When classifying the CIFAR10 in PyTorch, there are normally 50,000 training samples and 10,000 testing samples. However, if I need to create a validation set, I can do it by splitting the training set ...
0
votes
0answers
9 views

DL classification loss lowers but doesn't go to zero

I'm trying to train a text classifier using pytorch and the model currently uses pretrained embeddings, a bi-lstm followed by a linear layer and dropout. When I start training the loss is at 60-70, ...
0
votes
1answer
26 views

What is a latent space vector?

I do not understand this about GANs. Apparently the Generator is supposed to receive a latent space vector as its input. Yet I couldn't find an example of how I can implement it in Pytorch. This is a ...
0
votes
0answers
11 views

How can I use MIT CBCL dataset in python

I have downloaded the MIT CBCL face dataset, but I can't find any code online on how to use it in python. the MIT data set is in two formats .greynorm and .pgm format which I don't know how to use any ...
0
votes
0answers
16 views

CNN model with transfer learning not performing, training loss is still high, test accuracy is very low

Hi I'm trying to train a cnn model with transfer learning, and I am not able to get a good test accuracy (14%) - I don't know why it doesn't work for me. ...
1
vote
1answer
22 views

Supported GPU for Pytorch

Question Which GPUs are supported in Pytorch and where is the information located? Background Almost all articles of Pytorch + GPU are about NVIDIA. Is NVIDIA is the only GPU that can be used by ...
0
votes
1answer
11 views

Why is the variance going down so much in this weight initialization problem(using pytorch)?

first look at this example >>> x = t.randn(512) >>> w = t.randn(512, 500000) >>> (x @ w).var() tensor(513.9548) it makes sense that ...
0
votes
1answer
27 views

Dealing with input images of different shapes in PyTorch

I've started to work with a leaf classification dataset on Kaggle. All input images have different rectangular shapes. I want to transform the input into squares of a fixed size (say, 224x224) with a ...
1
vote
0answers
34 views

Pytorch lstm model very high loss in eval mode against train mode

I am using a Siamese network with a 2-layer lstm encoder and dropout=0.5 to classify string similarity. For each batch, I am randomly generating similar and ...
0
votes
1answer
26 views

PyTorch CNN network outputs homogeneous results

I am a beginner at data science and I got a project where I want to do nlp via a convolutional neural network in PyTorch. The problem is that regardless of what comes out of the convolutional layers, ...
0
votes
0answers
9 views

play session from ratings dataset in Movie20 M

I need to extract listening sessions from the ratings dataset which has the columns cols = [userId movieId rating timestamp] timestamp is just a number for eg 1112486027 listening sessions are ...
0
votes
0answers
42 views

Multi Class Text Classification

I am new in deep learning and I am trying to build a classification module which can classify text to one of 9 classes and then use the result of the classification to classify them to another set of ...
1
vote
0answers
28 views

Pytorch testing/validation accuracy over 100%

So I was training my CNN for some hours when it reached 99% accuracy (which was a little bit too good, I thought). But then it didn´t stop and it went higher than 100%. So I thought, that must be ...
0
votes
0answers
29 views

Beating Roulette with Neural Networks, YoloV3, and PyTorch

Background: I am in my last semester of electrical engineering, and I am working on my senior design project. The senior design project is a two-semester design project in which students outline, or ...
1
vote
0answers
19 views

High-dimensional indexing in PyTorch

I would like to grab tensor v1's third dim according to indices in tensor indices. I tried ...
1
vote
0answers
55 views

Would writing a decision tree algorithm in Pytorch or Tensorflow be faster than with Numpy?

Since these libraries can turn CPU arrays into GPU tensors, could you parallelize (and therefore accelerate) the calculations for a decision tree? I am considering making a decision tree class written ...
1
vote
0answers
14 views

Object coordinate detection with capsNet

Where can I find the implementation of object coordinate extraction with capsule networks in keras or pytorch?
0
votes
0answers
7 views

Training EfficientNet always throws CUDA exhausted error

I have been trying a hands on the EfficientNet-B6 architecture but evertime I try to train the same, It simply throws up CUDA resource exhausted error. I have been training it on 16GB Tesla P100
0
votes
0answers
10 views
1
vote
1answer
287 views

Autoencoder: using cosine distance as loss function

I'm trying to train an autoencoder (in PyTorch) to reconstruct gene profiles. At the moment I'm using the Mean Squared Error (MSE) loss for training: the model is not overfitting and both the training ...
0
votes
0answers
3 views

RNN batch outputs

Suppose, we have a set of variable length sequences. First: apply rnn unit to each sample and save outputs. Second: pad each sequence up to max_length with zeros at beginning. Apply same rnn unit to ...
1
vote
1answer
22 views

How to compare a sentence with a paragraph and get its probability in terms of correctness?

This is my first post on stackoverflow network and I am dealing with a machine learning. Lets say I have a paragraph describing a rabbit and tortoise story. The story concludes that tortoise is a ...
0
votes
0answers
18 views

Pytorch Implementing Simple Attention using Dummy data

Hi I am trying to implement simple/General attention in Pytorch , So far the model seems to working , but what i am intersted in doing is getting the attention weights , so that i can visualize it . ...
1
vote
1answer
186 views

How does the forward method get called in this pyTorch conv net?

In this example network from pyTorch tutorial ...
0
votes
0answers
12 views

Are there any other recommended optimizers for word2vec/glove than Adagrad and SparseAdam?

adagrad and sparseAdam work great for sparse training because there’s separate sums for each of the parameters. Are there any other recommended optimizers for embedding training?
0
votes
0answers
15 views

What transforms do we need to apply to masks of images in segmentation tasks

I am trying a semantic segmentation task for multi-class segmentation. I am wondering what transforms are applied to both images and masks in it. Following are my transforms- ...
0
votes
1answer
119 views

Layer shape computation in convolutional neural net (pyTorch)

How can you know the expected input size (image input size (tensor size)), for example for this network (cf. pyTorch tutorial example ): ...
0
votes
0answers
61 views

PyTorch order of dimensions for NN-layer weights

I'm following the PyTorch beginner tutorial on neural networks, and can't understand the dimension orderings. From what I've found on the internet, the order of dimensions for a data tensor in PyTorch ...
1
vote
0answers
40 views

PyTorch neural network parameters and tensor shapes

I am following this tutorial: https://pytorch.org/tutorials/beginner/blitz/neural_networks_tutorial.html it's quite nicely done, however I do not understand/see where you can know the expected image ...
0
votes
0answers
23 views

processing sequence of sequences in PyTorch

I try to deal with some special sequences via recurrent modules and I have faced some non-trivial things: Sequences are not in same length. I have sequence of sequences, and my idea is to encode ...
0
votes
1answer
403 views

Multichannel numpy array to PIL image

I have a 4 channel Numpy image that needs to be converted to PIL image in order implement torchvision transformations on image. But when I try to do this using ...
2
votes
1answer
90 views

Tensorboard with pytorch dont display a graph

I am trying to visualize a model I created using Tensorboard with Pytorch but when running tensorboard and going to the graph tab nothing is shown, im adding my code for reference, also im adding a ...
1
vote
0answers
41 views

How does a Faster R-CNN gets trained and how does the Region Proposal Network fits into that?

so a Faster R-CNN consists of 3 parts: -the Base CNN -the Region Proposal Network with RoIpooling -and the classification CNN at the end So I asked myself if all these three Networks are trained ...
0
votes
0answers
82 views

pytorch problem gradient calculation

I create a neuron. I'm having a problem with recounting gradients. The problem is that I scalarly multiply 2 tensors u @ v and normalize one of them. It is ...