title stringlengths 15 126 | category stringclasses 3
values | posts list | answered bool 2
classes |
|---|---|---|---|
CUDA alignment error when using DataParallel | null | [
{
"contents": "self.conv1 = nn.Conv2d(N.inputChannels, N.outputChannels, N.kernelSquareSize, stride = (1,1), padding = (1,1)); and now, as per the DataParallel documentation, I have: self.conv1 = nn.Conv2d(N.inputChannels, N.outputChannels, N.kernelSquareSize, stride = (1,1), padding = (1,1)); self.conv1 = torc... | false |
Build model from repeated template | null | [
{
"contents": "<SCODE>class Template(nn.Module):\n def __init__(self):\n super().__init__()\n def forward(self, *input):\n pass\n<ECODE> <SCODE>class BuildModel(nn.Module):\n def __init__(self, number_of_layers):\n super().__init__()\n # self.layer_n = Template() for n in ra... | false |
Discussion about datasets and dataloaders | vision | [
{
"contents": "However, there has been some issues that I had to solve in order to match my workflow. So I created this topic to either discuss about possible ameliorations in the dataset interface or ameliorations in my own workflow, which i like but may be far from perfect. So to my mind, dataset would be the... | false |
Output of RNN is not contiguous | null | [
{
"contents": "I would expect the output of RNN to be contiguous in memory. This doesn’t seem to be the case. For instance, the final output in this snippet has output.is_contiguous() == False. <SCODE>train = True\nnum_layers = 1\nbidirectional = True\nbi = 2 if bidirectional else 1\n\nx = Variable(torch.from_n... | false |
RNN for generating time series | null | [
{
"contents": "I’m trying to modify the world_language_model example to generate a time series. My naive approach was to replace the softmax output with a single linear output layer, and change the loss function to MSELoss. Unfortunately, my network seems to learn to output the current input, instead of predict... | false |
Compiling an Extension with CUDA files | null | [
{
"contents": "<SCODE>#include <THC/THC.h>\n\nextern THCState *state;\n\nint my_lib_add_forward_cuda(THCudaTensor *input, THCudaTensor *output)\n{\n float * pinput = THCudaTensor_data(state, input);\n float * poutput = THCudaTensor_data(state, output);\n for(...)\n {\n poutput[i] = do_something(pinput[i]... | false |
Understand mark_dirty() | null | [
{
"contents": "So I read the inline documentation about mark_dirty() here: I don’t quite understand what extra checks are needed for inplace operators. Would be great if the devs can give some hints. Thanks!",
"isAccepted": false,
"likes": null,
"poster": "yzhu"
},
{
"contents": "If you are ... | false |
Sampled softmax loss | null | [
{
"contents": "Hi, Does sampled softmax loss exist in pytorch? I cound not find it. Thanks",
"isAccepted": false,
"likes": 1,
"poster": "beegii"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "smth"
},
{
"contents": "",
"isAccepted": false,
"li... | false |
Leaf variable was used in an inplace operation | null | [
{
"contents": "",
"isAccepted": false,
"likes": 5,
"poster": "OswinLG"
},
{
"contents": "Loosely, tensors you create directly are leaf variables. Tensors that are the result of a differentiable operation are not leaf variables For example: <SCODE>w = torch.tensor([1.0, 2.0, 3.0]) # leaf vari... | false |
Updating PyTorch | null | [
{
"contents": "I just wanted to pin this topic, so that it can be used for future reference. <SCODE>conda config --add channels soumith\n<ECODE> <SCODE>conda update pytorch torchvision\n<ECODE> <SCODE>$HOME/anaconda3/lib/python3.5/site-packages/torch\n<ECODE> <SCODE>$HOME/anaconda3/lib/python3.5/site-packages/t... | false |
Will pytorch be supported on Windows? | null | [
{
"contents": "As the problem said, will pytorch be supported on Windows?",
"isAccepted": false,
"likes": null,
"poster": "cumttang"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "fmassa"
}
] | false |
How to get the df_do as we used in torch7 | null | [
{
"contents": "<SCODE> optimizer.zero_grad()\n output = model(data)\n loss = criterion(output, target)\n loss.backward()\n optimizer.step()\n<ECODE> So all the network is back-propagated when I call loss.backward() ?",
"isAccepted": false,
"likes": null,
"poster": "dafang_He"
}... | false |
Model.zero_grad only fill the grad of parameters to 0 | null | [
{
"contents": "",
"isAccepted": false,
"likes": 1,
"poster": "ypxie"
},
{
"contents": "",
"isAccepted": false,
"likes": 2,
"poster": "smth"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "apaszke"
},
{
"contents": "Thanks for the ex... | false |
Unrolling adversarial networks | null | [
{
"contents": "Hi, Is the point that we simulate optimisation of the discriminator for K steps, then use the final error at D to optimise the parameters of D from before we started unrolling? Does this mean we have to store a copy of D’s parameters before we start the unrolling procedure? Does this mean that we... | false |
Select GPU device through env vars | null | [
{
"contents": "",
"isAccepted": false,
"likes": 4,
"poster": "emanjavacas"
},
{
"contents": "<SCODE>CUDA_VISIBLE_DEVICES=1 python myscript.py\n<ECODE>",
"isAccepted": false,
"likes": 12,
"poster": "fmassa"
},
{
"contents": "thanks! are there any docs for this? I really co... | false |
Model parameter changes on every load | null | [
{
"contents": "Hi, I saved a model of a simple convnet created without using any loops in the class using torch.save(). When I load the same saved model using torch.load() and print parameters param.data iterating through model.parameters(), it prints different values each time while running the code. I used t... | false |
Adaptive learning rate | null | [
{
"contents": "How do I change the learning rate of an optimizer during the training phase? thanks",
"isAccepted": false,
"likes": 12,
"poster": "davidenitti"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "trypag"
},
{
"contents": "If you want to chan... | false |
Return activations for all the layers | null | [
{
"contents": "Hello, Given the following code: <SCODE>def forward(self, x):\n x = x.transpose(2,1)\n x = self.max_pool(x)\n x = x.view(x.size(0), -1)\n x = self.classifier(x)\n<ECODE> Does exist an elegant way to get back the results of each layer? Or I should use a dictionary containing a key for ... | false |
NaN when I use batch normalization (BatchNorm1d) | null | [
{
"contents": "I made a module that uses the following MLP module: <SCODE>class MLP(nn.Module):\n def __init__(self, size_layers, activation):\n super(MLP, self).__init__()\n self.layers=[]\n self.layersnorm = []\n self.activation=activation\n for i in range(len(size_layers... | true |
Sample multivariate normal with per-example standard deviation | null | [
{
"contents": "Hi, I want to do something similar to this: <SCODE>mu = torch.zeros(5, 2)\nsd = torch.ones(5)\ntorch.normal(mu, sd)\n<ECODE> I noticed in the 1d case it works: <SCODE>mu = torch.zeros(5, 1)\nsd = torch.ones(5)\ntorch.normal(mu, sd)\n<ECODE>",
"isAccepted": false,
"likes": null,
"poste... | false |
Getting error when resizing Variable | null | [
{
"contents": "But this gives an error: Is this a bug? The error message I get is:",
"isAccepted": false,
"likes": null,
"poster": "yusuf_isik"
},
{
"contents": "Resize only accepts integer arguments, you can’t pass in another Variable.",
"isAccepted": false,
"likes": null,
"post... | false |
Indexing a Variable with a mask generated from another Variable | null | [
{
"contents": "x[y[:,0] > 0] But I assume there should be a much easier way. Thanks.",
"isAccepted": false,
"likes": 2,
"poster": "yusuf_isik"
},
{
"contents": "Yeah, we’ve added the ability to select based on the long tensor a few days ago. I think it’s in the new binaries, so once you rein... | false |
GPU lost in training imagenet | null | [
{
"contents": "I trained pytorch example resnet18 on imagenet, after about 1 epoch the training hangs and nvidia-smi says GPU lost …",
"isAccepted": false,
"likes": null,
"poster": "stevegu"
},
{
"contents": "this is not specific to pytorch. it looks like you have either a hardware issue or ... | false |
Fast Tensor access in python? | null | [
{
"contents": "In lua torch, we can access a Tensor using luajit-FFI pointer as fast as in C. Do we have similar thing in pytorch?",
"isAccepted": false,
"likes": 1,
"poster": "yzhu"
},
{
"contents": "no. Python doesn’t have JITting.",
"isAccepted": false,
"likes": 4,
"poster": ... | false |
PyTorch tutorial for Neural transfert of artistic style | null | [
{
"contents": "Hi, If someones are interested, I’ve realized this PyTorch tutorial to implement the neural transfer of artistic style developed by Leon Gatys and AL: Any feedback is welcome!",
"isAccepted": false,
"likes": 6,
"poster": "alexis-jacq"
},
{
"contents": "",
"isAccepted": fal... | false |
In place randomization | null | [
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "eulerreich"
},
{
"contents": "you can do: <SCODE>a = torch.zeros(3, 4) # or whatever shape\ntorch.randn(3, 4, out=a)\n<ECODE> But yea we didn’t implement some methods. We just didn’t get around to it.",
"isAccepted": false,... | false |
How does autograd handle multiple objectives? | null | [
{
"contents": "Using the pytorch framework. Suppose you have 4 NN modules of which 2 share weights such that one objective relies on the computation of 3 NN modules (including the 2 that share weights) and the other objective relies on the computation of 2 NN modules of which only 1 belongs to the weight sharin... | false |
About the variable length input in RNN scenario | null | [
{
"contents": "Hi all, I am recently trying to build a RNN model for some NLP task, during which I found that the RNN layer interface provided by pytorch (no matter what cell type, gru or lstm) doesn’t support masking the inputs. Masking is broadly used in NLP domain for the inputs within a single batch having ... | false |
Loading huge data functionality | null | [
{
"contents": "Do you have any plan on implementing big data files loading functionality? Suppose I have 300G data files for training, and I can’t load them all into memory. With it, I don’t need to read all data set into memory at once, and I can load data in parallel fashion. Any plan on similar functionality... | false |
How to combine multiple criterions to a loss function? | null | [
{
"contents": "<SCODE>def loss_calc(data,targets):\n data = Variable(torch.FloatTensor(data)).cuda()\n targets = Variable(torch.LongTensor(targets)).cuda()\n output= model(data)\n final = output[-1,:,:]\n loss = criterion(final,targets)\n return loss\n<ECODE> <SCODE>def loss_calc(data,targets):\n data = ... | false |
On a cpu device, how to load checkpoint saved on gpu device | null | [
{
"contents": "Loading this checkpoint on my cpu device gives an error: <SCODE> raise AssertionError(\"Torch not compiled with CUDA enabled\")\nAssertionError: Torch not compiled with CUDA enabled```<ECODE>",
"isAccepted": false,
"likes": 8,
"poster": "Ja-Keoung_Koo"
},
{
"contents": "<SC... | false |
How to define a new layer with autograd? | null | [
{
"contents": "Hi all,",
"isAccepted": false,
"likes": 3,
"poster": "big_tree"
},
{
"contents": "Sure, this will be handled for you. For example: <SCODE>import torch.nn as nn\nfrom torch.autograd import Variable\n\nclass Gaussian(nn.Module):\n def __init__(self):\n self.a = nn.Para... | false |
Reducing LSTM Hidden State Output to 1 Dimension | null | [
{
"contents": "<SCODE>>>> rnn = nn.LSTM(1, 100, 4)\n>>> input = Variable(torch.randn(1, 1, 1))\n>>> h0 = Variable(torch.randn(4, 1, 100))\n>>> c0 = Variable(torch.randn(4, 1, 100))\n>>> output, hn = rnn(input, (h0, c0))\n<ECODE> Any ideas?",
"isAccepted": false,
"likes": null,
"poster": "ritchieng"
... | false |
LSTM Output Output Range | null | [
{
"contents": "",
"isAccepted": false,
"likes": 2,
"poster": "ritchieng"
},
{
"contents": "Can’t you just multiply the output by 10?",
"isAccepted": false,
"likes": 3,
"poster": "apaszke"
},
{
"contents": "<SCODE>from sklearn.preprocessing import MinMaxScaler\n\n# build a... | false |
Multi-GPU error | null | [
{
"contents": "After I wrapped my model with DataParallel, this error happened: RuntimeError: Assertion `THCTensor_(checkGPU)(state, 5, input, gradOutput, gradWeight, sorted, indices)’ failed. Some of weight/gradient/input tensors are located on different GPUs. Please move them to a single one. at /home/soumith... | false |
What’s the purpose of “retain_variables” in Variable backward function | null | [
{
"contents": "How to use “retain_variables” in Variable backward function. I tried the following code:",
"isAccepted": false,
"likes": 1,
"poster": "zhengyun"
},
{
"contents": "Hi, <SCODE>import torch\nfrom torch.autograd import Variable\nx = Variable(torch.ones(2, 2), requires_grad = True)... | false |
Sigmoid Belief Networks | null | [
{
"contents": "Cheers.",
"isAccepted": false,
"likes": null,
"poster": "GeorgeStam"
},
{
"contents": "Is there an efficient way to implement this as the full stochastic neuron? Would I call a simple one layer nn recursively, since Torch is dynamic? <SCODE>import numpy as np\nimport torch\nim... | false |
Clarifying input size to RNN in word_language_model example? | null | [
{
"contents": "Hi. I’m trying to understand something… How is this possible? If the model is expecting 20 inputs, shouldn’t it produce an error when you try to send it only 1? Furthermore, when I try to actually send the generation code a sequence of length 20 by creating… <SCODE>input = corpus.test[0:20]\npr... | false |
Converting a Variable to a Parameter | vision | [
{
"contents": "(Also notice that I’ve changed batch size to 1, is there a way to do this with bigger batches?) Thanks a lot.",
"isAccepted": false,
"likes": 1,
"poster": "Quilby"
},
{
"contents": "",
"isAccepted": false,
"likes": 1,
"poster": "apaszke"
},
{
"contents": "T... | false |
Properly make autograd.Function with scalar variable | null | [
{
"contents": "<SCODE>class mul_scalar(torch.autograd.Function):\n \"\"\"\n Customized autograd.Function of\n f(T,s) = s * T,\n where T is a fixed Tensor and s is a Variable\n \"\"\"\n\n def forward(self, T, s_var):\n self.save_for_backward(T, s_var)\n return T.mul(s_var[0])\n\n def backward(self, ... | false |
Problems with weight array of FloatTensor type in loss function | null | [
{
"contents": "I have mostly worked on keras with tf backend and sometimes dabbled with torch7. I was intrigued by the pytorch project and wanted to test it out. So, I was trying to run a simple model on a dataset where I loaded my features into a np.float64 array and the target labels into a np.float64 array. ... | false |
How to Reverse a Torch Tensor | null | [
{
"contents": "How to Reverse a Torch Tensor",
"isAccepted": false,
"likes": 1,
"poster": "peak"
},
{
"contents": "<SCODE>tensor = torch.rand(10) # your tensor\n# create inverted indices\nidx = [i for i in range(tensor.size(0)-1, -1, -1)]\nidx = torch.LongTensor(idx)\ninverted_tensor = tenso... | false |
Pytorch version of SpatialFullConvolution | null | [
{
"contents": "I am trying to recreate a torch7 model architecture in pytorch. I have used several layers of SpatialFullConvolution and as such, was wondering if there is anything analogous to that in PyTorch. I have not been able to find anything similar by name.",
"isAccepted": false,
"likes": null,
... | false |
Flatten the parameters in DataParallel | null | [
{
"contents": "I tried the ImageNet example with ResNet152 on 8GPUs but it is much slower than fb.resnet.torch (1.5s vs 0.8s per iter). It’s elegant to implement the Broadcast as an Op/Function. I wonder if it is possible to overlap the communication with computation during forward/backward? Or it is necessary ... | false |
How to create model with sharing weight? | null | [
{
"contents": "I want to create a model with sharing weights, for example: given two input A, B, the first 3 NN layers share the same weights, and the next 2 NN layers are for A, B respectively. How to create such model, and perform optimally?",
"isAccepted": false,
"likes": 6,
"poster": "xiaozhun07... | false |
Distribution Implementations | null | [
{
"contents": "",
"isAccepted": false,
"likes": 5,
"poster": "solidor"
},
{
"contents": "We didn’t plan on adding that, but it seems like a useful thing to have. It’s not going to be a priority for us, but if someone wants to send a PR, then we’ll be happy to merge it in.",
"isAccepted":... | false |
Installation problem for python 3.6 | null | [
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "Hamid"
},
{
"contents": "What’s your OS? Do you have a 64-bit system?",
"isAccepted": false,
"likes": null,
"poster": "apaszke"
},
{
"contents": "My OS is Ubuntu 14.04 64-bit",
"isAccepted": false,
"... | false |
Pre-trained network demo | null | [
{
"contents": "<SCODE># get input image\nimport skimage.io\nimport os\nfile_name = '26132.jpg'\nif not os.access(file_name, os.R_OK):\n file_URL = 'http://www.zooclub.ru/attach/26000/26132.jpg'\n os.system('wget ' + file_URL)\nimg = skimage.io.imread(file_name)\n\n\n# get model\nimport torchvision\nresnet... | false |
How to make custom method in nn.Module work with GPUs | vision | [
{
"contents": "I’m trying to implement simple res-net like below and it works with CPU. <SCODE>class ResNet(nn.module):\n def __init__(self):\n super(Net, self).__init__()\n self.conv_1 = nn.Conv2d(3, 64, 4, stride=2)\n self.bn_1 = nn.BatchNorm2d(64)\n self.res_1 = self.__res_bl... | false |
Some wrong while install via pip | null | [
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "JunshengShen"
},
{
"contents": "It’s a network error. Probably there’s a problem with your internet connection, or with a proxy if you use one.",
"isAccepted": false,
"likes": null,
"poster": "apaszke"
}
] | false |
PyTorch serialization | null | [
{
"contents": "Hi, Awesome library! I’d like to ask if it is possible to save a trained PyTorch model in (\"*.t7\") and read it in Torch. Thanks",
"isAccepted": false,
"likes": null,
"poster": "ablavatski1"
},
{
"contents": "No, we don’t have such option. PyTorch allows for creating much mor... | false |
Tensors as items in multiprocessing.queue | null | [
{
"contents": "<SCODE>import torch\nimport torch.multiprocessing as mp\n\ndef put_in_q(idx, q):\n q.put(torch.IntTensor(2, 2).fill_(idx))\n # q.put(idx) # works with int, float, str, np.ndarray, but not torch.Tensor\n\nq = mp.Queue()\n\np = mp.Process(target=put_in_q, args=(0, q))\np.start()\n\nx = q.get... | false |
Help debugging DenseNet model on CIFAR-10 | vision | [
{
"contents": "Hi PyTorch community, -Brandon.",
"isAccepted": false,
"likes": 2,
"poster": "bamos"
},
{
"contents": "One thing is that this: <SCODE>for param_group in optimizer.state_dict()['param_groups']:\n<ECODE> should be replaced with that: <SCODE>for param_group in optimizer.param_gro... | false |
Sum of matrices with different dimensions | null | [
{
"contents": "I am trying to sum two tensors with dimensions: \na: 10 x 49 x 1024 \nb: 10 x 1024 Thanks",
"isAccepted": false,
"likes": null,
"poster": "lcelona"
},
{
"contents": "How do you want to add these matrices? They have different numbers of elements.",
"isAccepted": false,
... | false |
How to replace Tensor.cmul functionality | null | [
{
"contents": "",
"isAccepted": false,
"likes": 1,
"poster": "evcu"
},
{
"contents": "<SCODE>a = torch.range(0, 99).view(10, 10)\nb = torch.range(0, 99).view(10, 10)\nc = a * b<ECODE>",
"isAccepted": false,
"likes": 2,
"poster": "mrdrozdov"
},
{
"contents": "",
"isAcc... | false |
How to perform finetuning in Pytorch? | null | [
{
"contents": "Can anyone tell me how to do finetuning in pytorch? Suppose, I have loaded the Resnet 18 pretrained model. Now I want to finetune it on my own dataset which contain say 10 classes. How to remove the last output layer and change to as per my requirement?",
"isAccepted": false,
"likes": 17,... | false |
Runtime error occurs when using .cuda(1) | null | [
{
"contents": "Hi all, I try to use pytorch on the 2nd GPU, <SCODE>`a = torch.ones(1).cuda(1)\n b = torch.ones(1).cuda(1)\n c = torch.cat((a,b),0)`\n<ECODE> Then an error comes out: RuntimeError: cuda runtime error (77) : an illegal memory access was encountered at /data/users/soumith/miniconda2/conda-bld/pytor... | false |
WhiteNoise Layer for DCGAN tutorial | null | [
{
"contents": "Hi everyone, Any hint would be welcome and I’m happy to make pull request as an added feature once done.",
"isAccepted": false,
"likes": null,
"poster": "lmoss"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "apaszke"
},
{
"contents": "I... | false |
AttributeError: ‘CudnnRNN’ object has no attribute ‘_nested_output’ | null | [
{
"contents": "The API is designed this way because I need this API to interact with another code that requires such calls. Simple LSTM (single input with multiple hidden states that are updated) <SCODE>from torch.autograd import Variable\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nimport... | false |
UNet implementation | null | [
{
"contents": "I’m still in the process of learning, so I’m not sure my implementation is right. Right now it seems the loss becomes nan quickly, while the network output “pixels” become 0 or 1 seemingly randomly. I’m not sure it is because of my implementation or because of my lack of understanding of the loss... | false |
Dynamic parameter declaration in forward function | null | [
{
"contents": "Declare the parameters in the forward function seems to be a solution because the intermediate results are already known at that point, but the thing is this might make the parameters be declared every time we run the forward function. <SCODE>def conv_relu(input):\n # Create variable named \"w... | false |
How to do mini batch with dynamic computation graph | null | [
{
"contents": "Hi all, I am new to framework with dynamic computation graph. I search everywhere but I couldn’t find a reference about how to implement mini-batch with RNN or even tree LSTM with varying length input. So I guess my general problem is how to do mini batch with dynamic computation graph. Thanks.",... | false |
Module.zero_grad() with requires_grad=False for some Parameter? | null | [
{
"contents": "It seems that Module.zero_grad() does not like parameters with no grad (source below crashes), but what is the proper way to have model parameters which should not be touched by the backprop, but should benefit from Module’s comfort (cuda() etc.)? <SCODE>import torch\n\nfrom torch import Tensor\n... | false |
Error on transpose and view | null | [
{
"contents": "<SCODE>import torch\nimport torch.nn.functional as F\ndef softmax(input, axis=1):\n \"\"\" \n Apply softmax on input at certain axis.\n \n Parammeters:\n ----------\n input: Tensor (N*L or rank>2)\n axis: the axis to apply softmax\n \n Returns: Tensor with softmax appli... | false |
PyTorch Resources | Site Feedback | [
{
"contents": "PyTorch is relatively new compared to other frameworks and I had issues finding more guides and tutorials.",
"isAccepted": false,
"likes": 11,
"poster": "ritchieng"
},
{
"contents": "Excellent. Will look into that and hopefully contribute in the future, although I am still usi... | false |
Updating pytorch versions? | null | [
{
"contents": "Thanks",
"isAccepted": false,
"likes": null,
"poster": "Kalamaya"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "apaszke"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "Kalamaya"
},
{
"contents":... | false |
What happened to documentation of nn.Sequential()? | null | [
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "Kalamaya"
},
{
"contents": "",
"isAccepted": false,
"likes": 1,
"poster": "apaszke"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "Kalamaya"
},
{
"contents": "We reco... | false |
PReLU and Conv3d bugs with 5d Tensors | null | [
{
"contents": "Here is an example of torch.nn.PReLU(num_parameters) acting on a 5d Tensor: <SCODE>out = nn.PReLU(8)(Variable(torch.rand(2,8,16,16,16)))\n<ECODE> The error looks like: <SCODE>RuntimeError: wrong number of input planes at /data/users/soumith/miniconda2/conda-bld/pytorch-cuda80-0.1.8_1486040640754/... | false |
Number of input for linear layer | null | [
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "SenJia"
},
{
"contents": "",
"isAccepted": false,
"likes": 1,
"poster": "apaszke"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "SenJia"
}
] | false |
Cuda Out of Memory | null | [
{
"contents": "Barely a few steps through my forward propagation for an LSTM I received an error: <SCODE>THCudaCheck FAIL file=/home/soumith/local/builder/wheel/pytorch-src/torch/lib/THC/generic/THCStorage.cu line=66 error=2 : out of memory\nTraceback (most recent call last):\n File \"external_script.py\", lin... | false |
Are only used parameters updated? | null | [
{
"contents": "When A is a module with multiple sub-modules, where only a sub-set of the sub-modules are used dependent on the input, for example, A is defined as follows, <SCODE>class A(nn.Module):\n def __init__(self):\n self.common = nn.Linear(100, 50)\n self.module1 = nn.Linear(50,30)\n ... | false |
Speed benchmark on VGG16 | vision | [
{
"contents": "I am testing pytorch’s speed on a simple VGG16 benchmark and I have noticed the following timings: Do these timings sound reasonable and is there a reason why Iteration 1 is much faster than the rest ? System specs: Thanks !",
"isAccepted": false,
"likes": null,
"poster": "tdeboissier... | false |
How to assign values to tensor based on index array efficiently? | null | [
{
"contents": "<SCODE>tf.TensorArray.scatter(indices, value, name=None)\n\nScatter the values of a Tensor in specific indices of a TensorArray.\n\nArgs:\n indices: A 1-D Tensor taking values in [0, max_value). If the TensorArray is not dynamic, max_value=size().\n value: (N+1)-D. Tensor of type dtype. The... | false |
Normalization in the mnist example | null | [
{
"contents": "",
"isAccepted": false,
"likes": 10,
"poster": "Russel_Russel"
},
{
"contents": "I think those are the mean and std deviation of the MNIST dataset.",
"isAccepted": false,
"likes": 1,
"poster": "avijit_dasgupta"
},
{
"contents": "",
"isAccepted": false,
... | false |
Non-determinisic results | null | [
{
"contents": "I run the follow code before definition of modules. (My model uses Embeding, Dropout, LSTM, and Linear layers.) <SCODE>torch.manual_seed(1000)\ntorch.backends.cudnn.enabled = False\ntorch.cuda.manual_seed(1000)\n<ECODE> However, the final results are still different for each trial (regardless I u... | false |
Format of weight parameters in KLDivLoss | null | [
{
"contents": "KLDivLoss can take a weight parameter but the docs don’t specify how it should be formatted. What should the format be?",
"isAccepted": false,
"likes": null,
"poster": "mromaniuk"
},
{
"contents": "It should be a 1D tensor having as many elements as you have classes. We’ll hav... | false |
Put a new top on ResNet | null | [
{
"contents": "I’m trying to replace the last layer of an imagenet trained model. <SCODE>model_imagenet = models.resnet18(pretrained=True)\nmodel_imagenet\n\nclass ResNetNewTop(nn.Module):\n def __init__(self, old_model, num_classes=2):\n super(ResNetNewTop, self).__init__()\n self.bottom = nn.... | false |
How to slice a matrice in PyTorch | null | [
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "Jie317"
},
{
"contents": "",
"isAccepted": false,
"likes": 2,
"poster": "Atcold"
},
{
"contents": "",
"isAccepted": false,
"likes": 7,
"poster": "apaszke"
}
] | false |
Runtime error caused by dependency engine? | null | [
{
"contents": "Test script: <SCODE>import torch\nimport torch.nn as nn\nfrom torch.autograd import Variable\n\nclass Net(nn.Module):\n\n def __init__(self, **config):\n super(Net, self).__init__()\n self.config = config\n self.embedding = nn.Embedding(config['vocab_size'], config['embedd... | false |
Reparameterizing a Parameter | null | [
{
"contents": "Hi guys, W_effective[:,:,::2,::2] = W_base And have a 5x5 filter which is effectively a dilated 3x3 filter, and where only the elements that I indexed in that call are parameters that can be updated. Note that I’m not just trying to dilate a filter (the convNd modules already look to have that on... | false |
Pretrained resnet model converted from caffe | null | [
{
"contents": "I’m using resnet to do feature extraction. I’m assuming the current resnet provided in model zoo is converted from fb.resnet.torch. Are you planning to convert the caffe model into pytorch version? (From my own experience, it seems the caffe one is better.)",
"isAccepted": false,
"likes":... | false |
Construct new tensor on correct device based on input | null | [
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "ypxie"
},
{
"contents": "",
"isAccepted": false,
"likes": 2,
"poster": "apaszke"
},
{
"contents": "Hi! I’m sorry to reply to an old post but I thought replying here would be better than starting a new topic.... | false |
How to get the class names to class label mapping | null | [
{
"contents": "I am using ResNet-18 for classification purpose. I have used dataloader to load the data. But how get the label to class name mapping? Does it load in alphabetical order?",
"isAccepted": false,
"likes": 1,
"poster": "avijit_dasgupta"
},
{
"contents": "For future reference: <SC... | false |
Improving the Performance of Fully Connected Neural Networks by Out-of-Place Matrix Transpose | null | [
{
"contents": "If these results are to be believed it’s perhaps worth looking into.",
"isAccepted": false,
"likes": null,
"poster": "Veril"
},
{
"contents": "Thanks for the reference! We’ll look into it.",
"isAccepted": false,
"likes": null,
"poster": "apaszke"
}
] | false |
Register_backward_hook on nn.Sequential | null | [
{
"contents": "<SCODE>import torch\nimport torch.nn as nn\nfrom torch.autograd import Variable\n\na = nn.Sequential(nn.Linear(5,3), nn.Tanh(), nn.Linear(3,2))\n\ndef hookFunc(module, gradInput, gradOutput):\n\tprint(len(gradInput))\n\tfor v in gradInput:\n\t\tprint v\na.register_backward_hook(hookFunc)\n\ninput... | false |
About pytorch update | null | [
{
"contents": "Hi all, Anybody know what this means?",
"isAccepted": false,
"likes": null,
"poster": "big_tree"
},
{
"contents": "Since the model structure is actually defined by the code, we’ve implemented a simple mechanism that saves the source code of each Module that you save, and when ... | false |
RuntimeError: could not compute gradients for some functions (CudnnRNN) | null | [
{
"contents": "Hi, Unfortunately getting the following behavior: <SCODE> File \"/home/jd/pytorch/examples/translation/translate_gpu.py\", line 296, in trainEpochs\n loss = train(input_variable, target_variable, encoder, decoder, encoder_optimizer, decoder_optimizer, criterion)\n\n File \"/home/jd/pytorch/e... | false |
Discussion on pyTorch packages: which ones do you use? | null | [
{
"contents": "Hello everyone! This is my first post in the forums. I am a new user, starting my Torch and pyTorch experience and I am very excited to do so! I am still going over documentation, tutorials and such and considering further options. One thing I thought I would ask the more experienced people in th... | false |
Are there any recommended methods to clone a model? | null | [
{
"contents": "I’m interested to clone a model for various reasons (makes it easy to stack untied versions of the same model for instance). Any recommended methods for doing so?",
"isAccepted": false,
"likes": 7,
"poster": "mrdrozdov"
},
{
"contents": "",
"isAccepted": false,
"likes"... | false |
How can I make custom nn.Module with max pooling index? | null | [
{
"contents": "I would like to custom nn.Module including max unpooling module. For example, if I declare MyModule1 and 2 which outputs the pooling index beside output signal and takes the pooling index (pool_idx), respectively, as below. <SCODE>class MyModule1(nn.Module):\n def __init__(self):\n super(M... | false |
Some confusions about nn.Linear that bothered me ;-( | null | [
{
"contents": "Linear layer requires 2D tensor. Does it mean that I got to use ‘view’ function to reshape the previous output every time I call it? But for some experiments BN and RELU are both needed afterwards. They both require 4D, for which I need to call reshape function again and again… and I can’t find o... | false |
Prefix parameter names in saved model if trained by multi-GPU? | null | [
{
"contents": "Hi, While doing inference I only use one GPU so the model failed to load the latter model file because the parameter names are not matching. I am wondering why parameter names are prepend the prefix? Can I trim the prefix and still use the model?",
"isAccepted": false,
"likes": 2,
"po... | false |
Trainable Variable in Loss Function and Matrix Multiplication | null | [
{
"contents": "Hi, could you check the example with trainable-variable? I was thinking about two cases: implementing a Linear layer without torch.nn. implementing the Loss layer with learable parameter (ex. Center Loss where mean-center is trainable parameters). Such stuff are easy in TesnotFlow, but I’m not su... | false |
Select specific columns of each row in a torch Tensor | null | [
{
"contents": "There’s probably a simple way to do this, but owing to my noobness I do not know who to do this in PyTorch. Basically, let’s say I have a torch tensor like so: m = Variable(torch.randn(4,2)) Furthermore, I have a bunch of indices, given by inds, where inds is: <SCODE>inds\nVariable containing\n 1... | false |
Convert to numpy cuda variable | null | [
{
"contents": "How to convert cuda variables to numpy?",
"isAccepted": false,
"likes": 2,
"poster": "pronics2004"
},
{
"contents": "<SCODE>cuda_tensor = torch.rand(5).cuda()\nnp_array = cuda_tensor.cpu().numpy()\n<ECODE>",
"isAccepted": false,
"likes": 15,
"poster": "fmassa"
},... | false |
Initialize a new network from a sub-network | null | [
{
"contents": "What is the best way to initialize a new network from a sub-network of larger network (saved using torch.save(net.state_dict())?",
"isAccepted": false,
"likes": null,
"poster": "pronics2004"
},
{
"contents": "",
"isAccepted": false,
"likes": null,
"poster": "fmassa... | false |
CUDA memory continuously increases when net(images) called in every iteration | null | [
{
"contents": "",
"isAccepted": false,
"likes": 4,
"poster": "Kalamaya"
},
{
"contents": "This is because pytorch will build a the graph again and again, and all the intermediate states will be stored.",
"isAccepted": false,
"likes": 9,
"poster": "ruotianluo"
},
{
"conten... | false |
Elegant way to transpose a variable | null | [
{
"contents": "For example, A Tensor with shape [2, 3, 4] -> [4, 2, 3] In numpy, we could directly use np.transpose(Tensor, [2, 0, 1]). However, in pytorch, I could not find a elegant way to do it. Thanks for your help.",
"isAccepted": false,
"likes": null,
"poster": "meijieru"
},
{
"content... | false |
Convert int into one-hot format | null | [
{
"contents": "Hi all. <SCODE>for batch_idx, (x, y) in enumerate(train_loader):\n y_onehot = y.numpy()\n y_onehot = (np.arange(num_labels) == y_onehot[:,None]).astype(np.float32)\n y_onehot = torch.from_numpy(y_onehot)\n<ECODE> However, I notice that the it gets slower each iteration, and I doubt it’s ... | false |
Gradient computation with index_select (for recursive neural networks) | null | [
{
"contents": "Hi all, My cell looks something like this: <SCODE>import torch\nimport torch.nn.functional as F\nimport torch.nn as nn\n\nclass ReNNCell(nn.Module):\ndef __init__(self, dim):\n super(ReNNCell, self).__init__()\n self.dim = dim\n self.W = nn.Linear(dim*2, dim)\n self.W_score = nn.Linea... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.