messages listlengths 2 8 | kind stringclasses 2
values | thread_id int64 17.3k 206k | url stringlengths 48 283 | created_at stringlengths 20 27 | tier stringclasses 2
values | answer_origin stringclasses 2
values | answer_post_numbers listlengths 1 5 | answer_authors listlengths 1 3 |
|---|---|---|---|---|---|---|---|---|
[
{
"role": "user",
"content": "KeyError when loading state_dict into my model\n\nHi, I have parameters `param.pth` and I want to load them into `model` like:\n\n```Python\nmodel = Net()\nmodel.load_state_dict(torch.load(\"param.pth\"))\n```\nbut it cause\n```Python\nKeyError: 'unexpected key \"0.weight\" in ... | answer | 17,291 | https://discuss.pytorch.org/t/keyerror-when-loading-state-dict-into-my-model/17291 | 2018-05-01T12:55:58.012000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "KeyError when loading state_dict into my model\n\nHi, I have parameters `param.pth` and I want to load them into `model` like:\n\n```Python\nmodel = Net()\nmodel.load_state_dict(torch.load(\"param.pth\"))\n```\nbut it cause\n```Python\nKeyError: 'unexpected key \"0.weight\" in ... | clarification | 17,291 | https://discuss.pytorch.org/t/keyerror-when-loading-state-dict-into-my-model/17291 | 2018-05-01T12:55:58.012000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Use model parameters in loss function\n\nHey,\n\nLet's say I have one trained neural network and want to train another one with the exact same topology.\nIn the 2nd network's loss function I'll have a base loss function like MSE and I want to extend it and add something else to... | answer | 17,305 | https://discuss.pytorch.org/t/use-model-parameters-in-loss-function/17305 | 2018-05-01T18:13:01.506000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Pytorch 0.4.0 on Google colab\n\nIt looks like I have installed the version 0.4.0 successfully as the attached screenshot.\n[image]\n\nBesides, I also ran !pip freeze to confirm torch==0.4.0\n\nHowever, when I run the code below. The version still shows '0.3.0.post4'!\n\n```\ni... | answer | 17,329 | https://discuss.pytorch.org/t/pytorch-0-4-0-on-google-colab/17329 | 2018-05-02T03:06:35.978000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Indexing Bug in Torch 0.4.0?\n\nPytorch 0.4.0\n\na = torch.rand(10, 10)\na[:, :0] = 0\n\nThen a 's first column becomes 0. Is this a bug?"
},
{
"role": "assistant",
"content": "Can confirm the syntax seems to have a different behavior than numpy.\nIn numpy `a[:, :0]... | answer | 17,338 | https://discuss.pytorch.org/t/indexing-bug-in-torch-0-4-0/17338 | 2018-05-02T05:45:05.257000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Different behavior of autograd.Variable\n\nI'm getting two different behaviors of `autograd.Variable` and I'm wondering if it's because of the pytorch version.\n\nOn my local machine (OS X, pytorch version 0.4.0), I get\n\n```\nIn [6]: type(autograd.Variable(torch.from_numpy(np... | answer | 17,362 | https://discuss.pytorch.org/t/different-behavior-of-autograd-variable/17362 | 2018-05-02T13:54:23.006000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "GPU 0 gets duplicate processes from processes running on other GPUs\n\nI am training different models on different GPUs simultaneously in one of my remote machines, and I found that the processes running on GPUs whose id isn't 0 are somehow duplicated on GPU whose id is 0, as s... | answer | 17,375 | https://discuss.pytorch.org/t/gpu-0-gets-duplicate-processes-from-processes-running-on-other-gpus/17375 | 2018-05-02T19:48:08.930000Z | silver | verbatim | [
5
] | [
"ngimel"
] |
[
{
"role": "user",
"content": "How does backward in Pytorch work?\n\nI am new to pytorch. I have this doubt. Will Pytorch be able to compute the gradients for predefined tensor functions like torch.sum, torch.cat, etc. ? Here is a code snippet for example\n\n```\nclass Module1(nn.Module):\n\n\tdef __init__(... | answer | 17,386 | https://discuss.pytorch.org/t/how-does-backward-in-pytorch-work/17386 | 2018-05-02T22:19:30.915000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "If we combine one trainable parameters with a non-trainable parameter, is the original trainable param trainable?\n\nSay I have two nets and I combine their parameters in some fancy way using only pytorch operations. I store the result in a third net which has its parameters se... | answer | 17,388 | https://discuss.pytorch.org/t/if-we-combine-one-trainable-parameters-with-a-non-trainable-parameter-is-the-original-trainable-param-trainable/17388 | 2018-05-02T22:25:57.350000Z | silver | verbatim | [
3
] | [
"colesbury"
] |
[
{
"role": "user",
"content": "Is there anybody happen this error?\n\n/opt/conda/conda-bld/pytorch_1512386481460/work/torch/lib/THCUNN/SpatialClassNLLCriterion.cu:99: void cunn_SpatialClassNLLCriterion_updateOutput_kernel(T *, T *, T *, long *, T *, int, int, int, int, int, long) [with T = float, AccumT = fl... | answer | 17,416 | https://discuss.pytorch.org/t/is-there-anybody-happen-this-error/17416 | 2018-05-03T07:46:24.489000Z | gold | verbatim | [
16
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Is there anybody happen this error?\n\n/opt/conda/conda-bld/pytorch_1512386481460/work/torch/lib/THCUNN/SpatialClassNLLCriterion.cu:99: void cunn_SpatialClassNLLCriterion_updateOutput_kernel(T *, T *, T *, long *, T *, int, int, int, int, int, long) [with T = float, AccumT = fl... | clarification | 17,416 | https://discuss.pytorch.org/t/is-there-anybody-happen-this-error/17416 | 2018-05-03T07:46:24.489000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Loss Functions Sensitivity to Input Data Size\n\nWhen working with Loss Functions, documentation states the size should be `(N, *)` where `N` is the batch size. \n\nThe question is, when working with nets which have output of size 1 (Regression Net) the output of the net has t... | answer | 17,499 | https://discuss.pytorch.org/t/loss-functions-sensitivity-to-input-data-size/17499 | 2018-05-04T09:50:01.793000Z | silver | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Efficient train/dev sets evaluation?\n\nHello everybody,\n\nWhat is the most efficient way to log train set and dev set accuracy and loss? Now I use the same function for both sets after training, i.e\n```\nfor epoch in range(1, N):\n train(epoch)\n evaluate(train_loader)... | answer | 17,514 | https://discuss.pytorch.org/t/efficient-train-dev-sets-evaluation/17514 | 2018-05-04T14:04:30.291000Z | gold | verbatim | [
10
] | [
"roaffix"
] |
[
{
"role": "user",
"content": "'BatchNorm2d' object has no attribute 'track_running_stats'\n\nSorry, I am using a new computer and I just installed the newest version of Pytorch.\nMy code runs perfectly on my old computer.\nBut now BatchNorm2d is giving me this error when the model is switched to evaluation ... | answer | 17,525 | https://discuss.pytorch.org/t/batchnorm2d-object-has-no-attribute-track-running-stats/17525 | 2018-05-04T16:43:04.552000Z | silver | composed | [
2,
3
] | [
"William_Lee",
"ptrblck"
] |
[
{
"role": "user",
"content": "Erro on calling nn.ReLU\n\nGetting the following error: \nRuntimeError: bool value of Tensor with more than one value is ambiguous\n\non running:\n\nnn.ReLU(torch.nand(2))"
},
{
"role": "assistant",
"content": "`nn.ReLU()` create a class. You should assign it to a v... | answer | 17,558 | https://discuss.pytorch.org/t/erro-on-calling-nn-relu/17558 | 2018-05-05T06:00:26.425000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Expected stride to be a single integer value or a list?\n\nI am using ResNet18 to do some transfer learning for a project. I have been able to follow the [Transfer Learning Tutorial](https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html) without any real issue ... | answer | 17,612 | https://discuss.pytorch.org/t/expected-stride-to-be-a-single-integer-value-or-a-list/17612 | 2018-05-06T09:59:07.811000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "FloatMSECriterion_updateOutput received an invalid combination of arguments\n\nHi all,\n\nI have a float label ( label = label.astype('float') ) in data_loader when I realize the Regression model.\nHowever, I met the following type error:\n\nTypeError: FloatMSECriterion_updateO... | answer | 17,622 | https://discuss.pytorch.org/t/floatmsecriterion-updateoutput-received-an-invalid-combination-of-arguments/17622 | 2018-05-06T14:36:07.940000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Ignore_index() in nn.CrossEntropyLoss() for semantic segmentation\n\nI am trying to train a fully convolutional net from scratch for a semantic segmentation task, but the training set I have is sparse, meaning that I have to ignore pixels that do not contain information (label=... | answer | 17,645 | https://discuss.pytorch.org/t/ignore-index-in-nn-crossentropyloss-for-semantic-segmentation/17645 | 2018-05-07T07:23:27.858000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Why is toTensor returning a DoubleTensor when its suppose to return a FloatTensor?\n\nAccording to [the docs](https://pytorch.org/docs/0.2.0/_modules/torchvision/transforms.html#ToTensor):\n\n```\nclass ToTensor(object):\n \"\"\"Convert a ``PIL.Image`` or ``numpy.ndarray`` t... | answer | 17,686 | https://discuss.pytorch.org/t/why-is-totensor-returning-a-doubletensor-when-its-suppose-to-return-a-floattensor/17686 | 2018-05-07T18:22:52.579000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "torch.nn.Conv2d custom filters\n\nHow torch.nn.Conv2d compute the convolution matrix using its default filter.\nI have a small problem to know how the calculation is performed and how to use my own filter (mask vector), and why we use unsqueeze from the model.\nMy code:\n> inpu... | answer | 17,694 | https://discuss.pytorch.org/t/torch-nn-conv2d-custom-filters/17694 | 2018-05-07T19:49:50.175000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Replacing a for loop with indexing\n\nI have a 3-dimensional tensor. 10_000 examples x 10 predicted labels x outputs from 3 models. `(10_000, 10, 3)`\n\nI also have a tensor with ids of the model outputs I would like to use for each label. It has 10 values between 0 and 2.\n\nI... | answer | 17,730 | https://discuss.pytorch.org/t/replacing-a-for-loop-with-indexing/17730 | 2018-05-08T11:22:29.843000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "ImageFolder data shuffle?\n\nHello everybody,\n\nDoes any function exists in pytorch that shuffles data before `DataLoader()`? I spent some time in search and still can not normally shuffle my output from `ImageFolder()` :face_with_raised_eyebrow:\n\nThanks,\nAnton"
},
{
... | answer | 17,731 | https://discuss.pytorch.org/t/imagefolder-data-shuffle/17731 | 2018-05-08T11:25:16.809000Z | gold | verbatim | [
10
] | [
"justusschock"
] |
[
{
"role": "user",
"content": "How to get the some certain element of every batch\n\nfor example, the shape of the output of the network is batchsize*w*h=16*7*8, how can I get the top left element of every batch, is there some pytorch operator to do it?"
},
{
"role": "assistant",
"content": "You ... | answer | 17,739 | https://discuss.pytorch.org/t/how-to-get-the-some-certain-element-of-every-batch/17739 | 2018-05-08T13:44:07.725000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Problem loading model trained on GPU\n\nI'm trying to load a model that has been trained on GPU intp a machine that doesn't have CUDA available and I get the following error:\n\n```\nTHCudaCheck FAIL file=torch/csrc/cuda/Module.cpp line=51 error=35 : CUDA driver version is insu... | answer | 17,745 | https://discuss.pytorch.org/t/problem-loading-model-trained-on-gpu/17745 | 2018-05-08T15:11:22.608000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Img2col operation in Pytorch\n\nHas anyone know this operation in Pytorch ?"
},
{
"role": "assistant",
"content": "What is your use case?\nMaybe you could use [tensor.unfold](https://pytorch.org/docs/stable/tensors.html#torch.Tensor.unfold)?"
},
{
"role": "u... | answer | 17,750 | https://discuss.pytorch.org/t/img2col-operation-in-pytorch/17750 | 2018-05-08T16:01:56.897000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "How to use the weight parameter for F.cross_entropy() correctly?\n\nI'm trying to write some code like below:\n```\nx = Variable(torch.Tensor([[1.0,2.0,3.0]]))\ny = Variable(torch.LongTensor([1]))\nw = torch.Tensor([1.0,1.0,1.0])\nF.cross_entropy(x,y,w)\nw = torch.Tensor([1.0,1... | answer | 17,786 | https://discuss.pytorch.org/t/how-to-use-the-weight-parameter-for-f-cross-entropy-correctly/17786 | 2018-05-09T08:24:37.292000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "GPU: no CUDA-capable device is detected\n\nGreetings pytorchers.\n\nI am trying to run pytorch on a machine with eight Testla K10G1.8GB GPUs (confirmed by nvidia-smi). \nCUDA is installed correctly and the samples from nvidia run (as do my own .cu tests).\nA simple example give... | answer | 17,789 | https://discuss.pytorch.org/t/gpu-no-cuda-capable-device-is-detected/17789 | 2018-05-09T11:32:00.856000Z | silver | composed | [
2,
4
] | [
"izoiluzja",
"ptrblck"
] |
[
{
"role": "user",
"content": "PyTorch callbacks\n\nIs there an official callback feature in PyTorch? If not, I'd like to know the relevant files to modify to make it happen. Basically, I want callbacks for functions like `on_batch_end()`, `on_epoch_end()` etc."
},
{
"role": "assistant",
"content... | answer | 17,815 | https://discuss.pytorch.org/t/pytorch-callbacks/17815 | 2018-05-09T17:40:35.002000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Relationship between the net structure and forward\n\nI try to understand the structure of a network but got confused. I want to know what determines the structure of a network, the __init__ function or the forward()?\n\nIn the tutorial, I saw a network can be defined as \n```\... | answer | 17,826 | https://discuss.pytorch.org/t/relationship-between-the-net-structure-and-forward/17826 | 2018-05-09T23:20:58.970000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Memory problem on ensembling the several pretrained models\n\nI'm trying to finetune the resnet model on Kaggle's dogs and cats redux, and I successfully trained and test when all the train and validation process is seperated for each model. But, when I tried to load 4 of the r... | answer | 17,896 | https://discuss.pytorch.org/t/memory-problem-on-ensembling-the-several-pretrained-models/17896 | 2018-05-11T02:34:00.082000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Manage GPU memory efficiently\n\nI am working on a model now and it takes 8GB momory on forward pass (It uses onling MaxPool3d and Conv3d layers). So if I use call backward function, the memory explode to 16 gigs right? Any tips on how to reduce memory usage (apart from reducin... | answer | 17,901 | https://discuss.pytorch.org/t/manage-gpu-memory-efficiently/17901 | 2018-05-11T04:38:00.021000Z | gold | composed | [
2,
6
] | [
"Naman-ntc",
"ptrblck"
] |
[
{
"role": "user",
"content": "Torchvision.transforms\n\nLet A be a tensor(CxHxW).\n\nWhat is the difference between torchvision.transforms.ToPILImage(A) and torchvision.transforms.ToPILImage()(A) ?"
},
{
"role": "assistant",
"content": "`transforms.ToPILImage()` takes an argument `mode`, which... | answer | 17,913 | https://discuss.pytorch.org/t/torchvision-transforms/17913 | 2018-05-11T09:01:10.264000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Why model.to(device) wouldn't put tensors on a custom layer to the same device?\n\nCurrently, I have to pass a `device` parameter into my custom layer and then manually put tensors onto the specified device manually using `.to(device)` or `device=device`.\n\nIs this behavior ex... | answer | 17,964 | https://discuss.pytorch.org/t/why-model-to-device-wouldnt-put-tensors-on-a-custom-layer-to-the-same-device/17964 | 2018-05-12T03:02:57.421000Z | gold | composed | [
6,
8
] | [
"ptrblck",
"yxchng"
] |
[
{
"role": "user",
"content": "Why model.to(device) wouldn't put tensors on a custom layer to the same device?\n\nCurrently, I have to pass a `device` parameter into my custom layer and then manually put tensors onto the specified device manually using `.to(device)` or `device=device`.\n\nIs this behavior ex... | clarification | 17,964 | https://discuss.pytorch.org/t/why-model-to-device-wouldnt-put-tensors-on-a-custom-layer-to-the-same-device/17964 | 2018-05-12T03:02:57.421000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Pretrained Densenet Problem\n\nPlease some one help me.\n\nI have written the following code.\n\nimport torch\nimport torchvision.models as models\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport torchvision.transforms as transforms\nimport cv2\n\nimage=cv2.imread('... | answer | 17,972 | https://discuss.pytorch.org/t/pretrained-densenet-problem/17972 | 2018-05-12T09:38:20.837000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "RuntimeError: already counted a million dimensions in a given sequence. Most likely your items are also sequences and there's no way to infer how many dimension should the tensor have using variables\n\nI read all posts regarding the same problem but couldn't figure my error ou... | answer | 18,033 | https://discuss.pytorch.org/t/runtimeerror-already-counted-a-million-dimensions-in-a-given-sequence-most-likely-your-items-are-also-sequences-and-theres-no-way-to-infer-how-many-dimension-should-the-tensor-have-using-variables/18033 | 2018-05-13T20:52:10.970000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Out Of Memory error After 15 Epochs on Wideresnet\n\nGetting Generic Out of Memory Error, after 15 epcohs, Seems like Some variable is accumulating over time, and then I am getting this error. My Program was working fine in earlier version of Pytorch I Upgraded to version 0.4.0... | answer | 18,039 | https://discuss.pytorch.org/t/out-of-memory-error-after-15-epochs-on-wideresnet/18039 | 2018-05-13T23:03:57.804000Z | silver | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Out Of Memory error After 15 Epochs on Wideresnet\n\nGetting Generic Out of Memory Error, after 15 epcohs, Seems like Some variable is accumulating over time, and then I am getting this error. My Program was working fine in earlier version of Pytorch I Upgraded to version 0.4.0... | clarification | 18,039 | https://discuss.pytorch.org/t/out-of-memory-error-after-15-epochs-on-wideresnet/18039 | 2018-05-13T23:03:57.804000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Should `DataLoader` workers add examples directly to the GPU?\n\nShould `DataLoader` workers add examples directly to the GPU? Or should that be handled by the main process?\n\nSpecifically, the `DataLoader` is using the `Dataset`'s `__getitem__` method to prepare the next batc... | answer | 18,048 | https://discuss.pytorch.org/t/should-dataloader-workers-add-examples-directly-to-the-gpu/18048 | 2018-05-14T02:09:36.196000Z | gold | verbatim | [
2
] | [
"SimonW"
] |
[
{
"role": "user",
"content": "Manually copying weights is Bad?\n\nIs copying weight in convnet layers a bad idea?\nI was performing [model inflation](https://arxiv.org/pdf/1705.07750.pdf) over 2D conv architecture (that is taking 2D kernel and stacking its copies together to form 3D kernel). \nI manually co... | answer | 18,056 | https://discuss.pytorch.org/t/manually-copying-weights-is-bad/18056 | 2018-05-14T05:53:57.329000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Change values inside a 3D tensor\n\nI have a 224x224 binary image in a tensor (1, 224, 224), with 0-pixels representing background a 1-pixels representing foreground. I want to reshape it in a tensor (2, 224, 224), such as the first \"layer\" gt[0] has 1-pixels where there were... | answer | 18,069 | https://discuss.pytorch.org/t/change-values-inside-a-3d-tensor/18069 | 2018-05-14T09:45:50.122000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "How to setup numerical warning?\n\nConsider\n\n> torch.Tensor([torch.exp(torch.Tensor([10000]))])\n\nit gives\n\n> tensor([inf.])\n\nwithout raising any warning or error. During the training, many time I end up with nan value; and have to debug all the way to figure when did t... | answer | 18,091 | https://discuss.pytorch.org/t/how-to-setup-numerical-warning/18091 | 2018-05-14T17:41:14.360000Z | gold | verbatim | [
5
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "How to change the shape of tensor\n\nI have a tensor and the shape of it is 7x748. However, I want to reshape it to 7x748x1, and I use the torch.view\nfor example, data.view(7, 748,1), but it does not work. Could anyone give me some advice to reshape the data to (7,748,1)?"
}... | answer | 18,118 | https://discuss.pytorch.org/t/how-to-change-the-shape-of-tensor/18118 | 2018-05-15T06:41:07.378000Z | gold | verbatim | [
3
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Get_device is not implemented for type torch.FloatTensor\n\nI am getting the following error of doing a forward pass on my model\n\n```\n File \"/media/newDrive/rishabh/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 491, in __call__\n result = self... | answer | 18,140 | https://discuss.pytorch.org/t/get-device-is-not-implemented-for-type-torch-floattensor/18140 | 2018-05-15T13:48:14.422000Z | gold | composed | [
2,
3
] | [
"Naman-ntc",
"ptrblck"
] |
[
{
"role": "user",
"content": "How to calculate the first parameter of nn.Linear()\n\nI am new to PyTorch.\n\nWhen I was reading some examples, I have some questions.\n\nLatest github example of mnist, in line 15 there is a number 320 in nn.Linear(), but I don't know how to get that number.\n\n```Python\ncla... | answer | 18,176 | https://discuss.pytorch.org/t/how-to-calculate-the-first-parameter-of-nn-linear/18176 | 2018-05-16T03:35:28.015000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "How to get deterministic behavior?\n\nI am using:\n\ncudnn.benchmark = False\ncudnn.deterministic = True\n\nrandom.seed(1)\nnumpy.random.seed(1)\ntorch.manual_seed(1)\ntorch.cuda.manual_seed(1)\n\nAnd still not getting deterministic behavior…"
},
{
"role": "assistant",
... | answer | 18,177 | https://discuss.pytorch.org/t/how-to-get-deterministic-behavior/18177 | 2018-05-16T04:34:41.894000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Why does several models in one Python kernel take so little memory?\n\nHi all!\nI encountered strange GPU behavior and can't figure why it happens.\nI have created five NN's architectures in a single python kernel. So there are 5 instances of classes net_1, ..., net_5 which tak... | answer | 18,210 | https://discuss.pytorch.org/t/why-does-several-models-in-one-python-kernel-take-so-little-memory/18210 | 2018-05-16T12:31:12.259000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Same code meet out of memory problems in Pytorch.0.4\n\n**The problem is when doing validation , the input image is 1024 * 2048 , 4 images for 4 1080ti gpu (each gpu per image).** I met this error.\nTHCudaCheck FAIL file=/pytorch/aten/src/THC/generic/THCStorage.cu line=58 erro... | answer | 18,246 | https://discuss.pytorch.org/t/same-code-meet-out-of-memory-problems-in-pytorch-0-4/18246 | 2018-05-17T07:54:03.056000Z | gold | verbatim | [
3
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Reshaping tensor\n\nI have a tensor of size (24, 2, 224, 224) in Pytorch.\n24 = batch size\n2 = matrixes representing foreground and background\n224 = image height dimension\n224 = image width dimension\n\nThis is the output of a CNN that performs binary segmentation. In each c... | answer | 18,260 | https://discuss.pytorch.org/t/reshaping-tensor/18260 | 2018-05-17T12:40:24.802000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Grayscale to RGB transform\n\nSome of the images I have in the dataset are gray-scale, thus, I need to convert them to RGB, by replicating the gray-scale to each band. I am using a transforms.lambda to do that, based on torch.cat. However, this seems to not give the expected r... | answer | 18,315 | https://discuss.pytorch.org/t/grayscale-to-rgb-transform/18315 | 2018-05-18T14:53:16.103000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "How to register a module in a list to be a submodule of a huge module?\n\nHello, I'm trying to create such a Network:\n```\nclass Net(torch.nn.Module):\n def __init__(self):\n super(Net, self).__init__()\n self.linears = [torch.nn.Linear(5, 10)] * 10\n s... | answer | 18,338 | https://discuss.pytorch.org/t/how-to-register-a-module-in-a-list-to-be-a-submodule-of-a-huge-module/18338 | 2018-05-19T07:01:20.060000Z | gold | verbatim | [
3
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Conv2d behaviour question\n\nI'm trying to understand the behaviour of the Conv2d layer in Pytorch, but it gives different results in scenarios in which I expect the same results.\n\nMaybe I'm missing something?\n\n**Example (link to [jupyter notebook](https://github.com/DIAGNi... | answer | 18,359 | https://discuss.pytorch.org/t/conv2d-behaviour-question/18359 | 2018-05-19T16:30:06.869000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "KeyError: 'track_running_stats' on loading a older version model in pytorch 0.4\n\nI tried to load an old pytorch version built model in pytorch 0.4 but I recieved this error on accessing the layers of model : \n\n```\npython3.6/site-packages/torch/nn/modules/batchnorm.py\", l... | answer | 18,374 | https://discuss.pytorch.org/t/keyerror-track-running-stats-on-loading-a-older-version-model-in-pytorch-0-4/18374 | 2018-05-20T06:23:12.013000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Invalid argument runtime error\n\nHello everybody,\n\nI'm using python 3.6 (64 bit) with pytorch (0.3.1 post 2) on Windows 10.\n\nI received the following run time error;\n\n\"RuntimeError: invalid argument 2: out of range at c:\\anaconda2\\conda-bld\\pytorch_1519496000060\\wor... | answer | 18,438 | https://discuss.pytorch.org/t/invalid-argument-runtime-error/18438 | 2018-05-21T12:32:18.904000Z | silver | verbatim | [
11
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Invalid argument runtime error\n\nHello everybody,\n\nI'm using python 3.6 (64 bit) with pytorch (0.3.1 post 2) on Windows 10.\n\nI received the following run time error;\n\n\"RuntimeError: invalid argument 2: out of range at c:\\anaconda2\\conda-bld\\pytorch_1519496000060\\wor... | clarification | 18,438 | https://discuss.pytorch.org/t/invalid-argument-runtime-error/18438 | 2018-05-21T12:32:18.904000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Can't iter(Dataloader Object).BrokenPipeError\n\nSorry for my terrible English...\n\nI run the code from 60mins tutorial,like this.\n\ntrainset = torchvision.datasets.CIFAR10(root='./datasets', train=True, download=True, transform=transform) \ntrainloader = torch.utils.data.Dat... | answer | 18,451 | https://discuss.pytorch.org/t/cant-iter-dataloader-object-brokenpipeerror/18451 | 2018-05-21T15:34:49.893000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Backward() on parameter that requires_grad=True; but still get does not have a grad_fn\n\nFollowing is a simple version of my original code.\n\nBasically; the code does two things\n\n(1) optimize the objective function use the gradient descent \n\n(2) control the gradients comp... | answer | 18,475 | https://discuss.pytorch.org/t/backward-on-parameter-that-requires-grad-true-but-still-get-does-not-have-a-grad-fn/18475 | 2018-05-22T03:11:50.510000Z | gold | verbatim | [
2
] | [
"rasbt"
] |
[
{
"role": "user",
"content": "Couple of models in production\n\nHi everyone,\n\nI'm trying to use couple of different models simultaneously in one big algorithm. Is it possible to run them on single GPU at the same time? And as I see, its kinda hard to deploy pytorch models in production pipeline. Should I ... | answer | 18,501 | https://discuss.pytorch.org/t/couple-of-models-in-production/18501 | 2018-05-22T11:22:47.209000Z | gold | verbatim | [
5
] | [
"roaffix"
] |
[
{
"role": "user",
"content": "What does batchnorm's output depend on?\n\nI have 2 batchnorm layers, both have same `weight`, same `bias`, same `running_mean` and same `running_var`. The first is a BatchNorm2D layer and second is a BatchNorm3D layer\n\nI give an input `x2d` (1x128x64x64) to first BatchNorm2d... | answer | 18,528 | https://discuss.pytorch.org/t/what-does-batchnorms-output-depend-on/18528 | 2018-05-22T19:18:11.157000Z | gold | verbatim | [
5
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Simple Artificial Neural Network\n\nHello ,\n I'm new to PyTorch, I want to construct a simple Neural Network with one hidden layer (Relu), the input will be a 1930 * 240 tensor, output 1930 * 10. Is there any template code with commentary to learn and thank you."
},
{
... | answer | 18,534 | https://discuss.pytorch.org/t/simple-artificial-neural-network/18534 | 2018-05-22T21:29:02.285000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Need help on custom loss\n\nHi there,\n\n**The problem is the gradient is None on my custom loss (Dice loss).** \n\n1) to verify the setup is correct, I used the\n\n> criterion = nn.BCEWithLogitsLoss(size_average=False, reduce=True).\n\nThe setup is indeed correct as I can retr... | answer | 18,543 | https://discuss.pytorch.org/t/need-help-on-custom-loss/18543 | 2018-05-23T04:28:04.812000Z | gold | composed | [
2,
3,
4
] | [
"ptrblck",
"wfpytorch"
] |
[
{
"role": "user",
"content": "How to pretrain a CNN?\n\nHey there! Awesome Community here, I love it.\nI hope you can help me understand the concept of pretraining.\nMy problem: I would like to track mouse movement for a neurological lab experiment.\n\nWhat I have done so far: I developed a simple dataset o... | answer | 18,555 | https://discuss.pytorch.org/t/how-to-pretrain-a-cnn/18555 | 2018-05-23T07:45:27.520000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Implementing a custom convolution using conv2d_input and conv2d_weight\n\nHi,\nI have been trying to implement a custom convolutional layer.\nIn order to do that, I'm using torch.nn.functional.conv2d in the forward pass, and both torch.nn.grad.conv2d_weight and torch.nn.grad.co... | answer | 18,556 | https://discuss.pytorch.org/t/implementing-a-custom-convolution-using-conv2d-input-and-conv2d-weight/18556 | 2018-05-23T08:27:36.110000Z | gold | verbatim | [
12
] | [
"Shi_Heng"
] |
[
{
"role": "user",
"content": "Implementing a custom convolution using conv2d_input and conv2d_weight\n\nHi,\nI have been trying to implement a custom convolutional layer.\nIn order to do that, I'm using torch.nn.functional.conv2d in the forward pass, and both torch.nn.grad.conv2d_weight and torch.nn.grad.co... | clarification | 18,556 | https://discuss.pytorch.org/t/implementing-a-custom-convolution-using-conv2d-input-and-conv2d-weight/18556 | 2018-05-23T08:27:36.110000Z | gold | verbatim | [
2
] | [
"Tony_Lee"
] |
[
{
"role": "user",
"content": "Run time get device parameters?\n\nFor a self-defined nn.Module, we can easily convert between cpu and cuda by means of `.to(device)` if our variable is defined as :\n```python\nclass MyModule(nn.Module):\n def __init__():\n var1 = nn.Parameters()\n var2 = nn.regis... | answer | 18,618 | https://discuss.pytorch.org/t/run-time-get-device-parameters/18618 | 2018-05-24T12:32:36.574000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Input Tensor created on GPU and not moving to CPU despite forcing using .cpu()\n\nI trained a model on GPU with DataParallel.\n\nI saved the best model to disk.\n\n```\nfull_state = {'epoch': epoch, 'arch': args.arch, 'model_state_dict': model.state_dict(),\n ... | answer | 18,644 | https://discuss.pytorch.org/t/input-tensor-created-on-gpu-and-not-moving-to-cpu-despite-forcing-using-cpu/18644 | 2018-05-25T06:01:26.008000Z | silver | composed | [
2,
7
] | [
"dlmacedo",
"rasbt"
] |
[
{
"role": "user",
"content": "Using .cuda() is very slow on pytorch=0.2.0\n\nDue to compatibility issues, I am using pytorch=0.2.0 with python=2.7\n\nI installed it using `conda install pytorch=0.2.0 cuda80 -c soumith` as it was pointed out on the forum that this will lead to reduction in lag while using `... | answer | 18,662 | https://discuss.pytorch.org/t/using-cuda-is-very-slow-on-pytorch-0-2-0/18662 | 2018-05-25T09:20:25.540000Z | silver | verbatim | [
6
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Leaf variable has been moved into the graph interior\n\nI am using PyTorch 0.4\n\nimport torch\nX=torch.randn((100,3))\nY=torch.randn((100))\nw1=torch.tensor(0.1, requires_grad=True)\nw2=torch.tensor(0.1, requires_grad=True)\nw3=torch.tensor(0.1, requires_grad=True)\nW=torch.te... | answer | 18,679 | https://discuss.pytorch.org/t/leaf-variable-has-been-moved-into-the-graph-interior/18679 | 2018-05-25T14:36:34.169000Z | gold | verbatim | [
6
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Difference between batch_input and \"for loop\"\n\nI have a question.\nFor pytorch0.3.0s.\n(I)I use the following code:\n total_loss = net([batch_size, input_size]) #means all batch_size train samples\n total_loss.backward()\n optimizer.step()\n(II)I use the following ... | answer | 18,680 | https://discuss.pytorch.org/t/difference-between-batch-input-and-for-loop/18680 | 2018-05-25T14:39:57.703000Z | gold | verbatim | [
7
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Need help---can I modify a batchnorm2d's num_features?\n\nHow can I just modify a batchnorm2d's num_features?\nFor example, how to create a new batchnorm2d's object with new num_features and old other properties?\\\nThank You!"
},
{
"role": "assistant",
"content": "... | answer | 18,685 | https://discuss.pytorch.org/t/need-help-can-i-modify-a-batchnorm2ds-num-features/18685 | 2018-05-25T16:48:04.571000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Beginner: Should ReLU/sigmoid be called in the __init__ method?\n\nI am trying to rebuild a Keras architecture in pytorch, which looks like this\n\n```\n rnn_layer1 = GRU(25) (emb_seq_title_description)\n # [...]\n main_l = Dropout(0.1)(Dense(512,activation='relu') (ma... | answer | 18,689 | https://discuss.pytorch.org/t/beginner-should-relu-sigmoid-be-called-in-the-init-method/18689 | 2018-05-25T17:52:07.301000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Torch.split in batches\n\nHello,\n\nDoes anyone know how to split batches of tensors in different positions each?\n\nI am trying to separate my tensors in two parts according to the `split_position`, which is different for each sample\n\n```\nbatch.shape = torch.Size([128, 68, ... | answer | 18,711 | https://discuss.pytorch.org/t/torch-split-in-batches/18711 | 2018-05-26T17:58:01.268000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Can this be achieved?\n\nHi There!\n\nCan something like this list of Conv1d layers be achieved using a single Conv2d or Conv2dTransposed? I tried thinking really hard but was unable to think of something clever!\n\n```python\nassert in_channels < out_channels\nassert features.... | answer | 18,740 | https://discuss.pytorch.org/t/can-this-be-achieved/18740 | 2018-05-27T17:04:35.811000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Can this be achieved?\n\nHi There!\n\nCan something like this list of Conv1d layers be achieved using a single Conv2d or Conv2dTransposed? I tried thinking really hard but was unable to think of something clever!\n\n```python\nassert in_channels < out_channels\nassert features.... | clarification | 18,740 | https://discuss.pytorch.org/t/can-this-be-achieved/18740 | 2018-05-27T17:04:35.811000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Size of tensor a (32) must match size of tensor b (7) at non-singleton dimension 1\n\nSo, I am doing capsnet in pytorch and borrowed this code from - https://github.com/cedrickchee/capsule-net-pytorch\n\n**model.py**\n```\n\"\"\"CapsNet Architecture\n\nPyTorch implementation of... | answer | 18,758 | https://discuss.pytorch.org/t/size-of-tensor-a-32-must-match-size-of-tensor-b-7-at-non-singleton-dimension-1/18758 | 2018-05-28T08:23:02.301000Z | silver | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "How to normalize a tensor to 0 mean and 1 variance?\n\nHi I'm currently converting a tensor to a numpy array just so I can use sklearn.preprocessing.scale\nIs there a way to achieve this in PyTorch? I have seen there is torchvision.transforms.Normalize but I can't work out how ... | answer | 18,766 | https://discuss.pytorch.org/t/how-to-normalize-a-tensor-to-0-mean-and-1-variance/18766 | 2018-05-28T10:18:32.519000Z | gold | verbatim | [
3
] | [
"yvanscher"
] |
[
{
"role": "user",
"content": "Input numpy ndarray instead of images in a CNN\n\nHello,\n\nI am kind of new with Pytorch.\n\nI would like to run my CNN with some ordered datasets that I have.\nI have n-dimensional arrays, and I would like to pass them like the input dataset.\nIs there any way to pass it with... | answer | 18,797 | https://discuss.pytorch.org/t/input-numpy-ndarray-instead-of-images-in-a-cnn/18797 | 2018-05-28T16:47:41.357000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "DataLoader Error About type mismatch when returning numpy arrays\n\n**EDIT :**\n\nI created a dataset class that alternatively returns data elements from two different datasets I have. the return type of `__getitem__` function is tuple of numpy arrays\nWhen I use a batch size 2... | answer | 18,814 | https://discuss.pytorch.org/t/dataloader-error-about-type-mismatch-when-returning-numpy-arrays/18814 | 2018-05-29T06:23:43.031000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Some problem with iteration by Tensor\n\n```\nbatch_in = torch.zeros((3, 3, 1))\n\nbatch_in[0] = torch.Tensor([1, 2, 3])\nbatch_in[1] = torch.Tensor([1, 2, 0])\nbatch_in[2] = torch.Tensor([1, 0, 0])\n```\n\nI got error:\n```\nRuntimeError: The expanded size of the tensor (1) mu... | answer | 18,831 | https://discuss.pytorch.org/t/some-problem-with-iteration-by-tensor/18831 | 2018-05-29T09:45:01.871000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Very small learning rate needed for convergence\n\nI am training a custom patch-based network (4 layers) and I realized that, unless I set the lr to 0.0000001 to start converging somehow.\nI feel like something is wrong with such a tuning.\nHowever, if I run the training with l... | answer | 18,833 | https://discuss.pytorch.org/t/very-small-learning-rate-needed-for-convergence/18833 | 2018-05-29T11:21:30.675000Z | gold | verbatim | [
6
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Cuda runtime error (59) after printing a tensor\n\nHi,\n\nI am using a linear layer like the following:\n\n**self.emb_to_seq = nn.Linear(512, 40000)**\n\n**img_seq = self.emb_to_seq(V)**\n\nthe tensor V has the shape of (8, 121, 512) and type of CudaFloatTensor.\n\nWhen I want ... | answer | 18,963 | https://discuss.pytorch.org/t/cuda-runtime-error-59-after-printing-a-tensor/18963 | 2018-05-31T10:11:31.672000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "The same seed but different running results on two executions\n\nI just written a simple model to classify cifar10 like below method:[https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html#sphx-glr-beginner-transfer-learning-tutorial-py](https://pytorch.org/tuto... | answer | 19,017 | https://discuss.pytorch.org/t/the-same-seed-but-different-running-results-on-two-executions/19017 | 2018-06-01T09:51:38.829000Z | gold | verbatim | [
13
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Train and validate simultaneously on two datasets\n\nI have two datasets each of 142.000 images, one for training and one for validation. What I have implemented is that it goes through the train data set (batchsize 11) and trains.\nBut what I now want to do is the following:\n... | answer | 19,020 | https://discuss.pytorch.org/t/train-and-validate-simultaneously-on-two-datasets/19020 | 2018-06-01T10:29:21.184000Z | gold | verbatim | [
3
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Initialization of network using specific (pre-trained) parameters of VGG16\n\nHi all,\n\nI am new to PyTorch (have some good experience in Theano/Lasagne), and I am trying to build an SSD-like architecture.\n\nI define the following class (apologies for its length):\n\n```\ncla... | answer | 19,039 | https://discuss.pytorch.org/t/initialization-of-network-using-specific-pre-trained-parameters-of-vgg16/19039 | 2018-06-01T13:09:39.400000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Checkpoint with no grad requiring inputs PROBLEM\n\nThe first thing that happens in my model forward method is calling checkpoint few times using several feature extractors.\nHowever, I get the following warning:\n\n```\n UserWarning: None of the inputs have requires_grad=True.... | answer | 19,117 | https://discuss.pytorch.org/t/checkpoint-with-no-grad-requiring-inputs-problem/19117 | 2018-06-03T07:47:23.758000Z | gold | verbatim | [
9
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Pytorch RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed. at /opt/conda/conda\n\nI have been trying to teach myself Pytorch using some Kaggle data on the seedlings competition. My code was working but taking a long time to run so decided to try to free... | answer | 19,118 | https://discuss.pytorch.org/t/pytorch-runtimeerror-assertion-cur-target-0-cur-target-n-classes-failed-at-opt-conda-conda/19118 | 2018-06-03T08:47:56.708000Z | silver | verbatim | [
6
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Newbie question: Grad set to None in second optimizer pass\n\nI am implementing a manual gradient descend to understand gradients better. \n\n```\nclass Optimizer:\n def __init__(self, m, b, learning_rate):\n self.m = m\n self.b = b\n self.learning_rate ... | answer | 19,122 | https://discuss.pytorch.org/t/newbie-question-grad-set-to-none-in-second-optimizer-pass/19122 | 2018-06-03T09:22:49.675000Z | silver | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Error while running Pytorch DataLoading tutorial\n\nI am trying to use my custom dataset and hence downloaded the the code data_loading_tutorial available in the Pytorch tutorials. \n\nThe code works fine till the line:\n\n__transformed_dataset = FaceLandmarksDataset(csv_file='... | answer | 19,156 | https://discuss.pytorch.org/t/error-while-running-pytorch-dataloading-tutorial/19156 | 2018-06-04T08:49:53.231000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Advanced indexing with torch.topk\n\nSuppose I have a 3d Tensor `x`, and I run `itorch.topk(x, k=2, dim=0)[1]` to retrieve the indices of the first two max values over the 0th dimension.\n\nThen I want to use those indices to index the tensor to assign a value, however I am not... | answer | 19,170 | https://discuss.pytorch.org/t/advanced-indexing-with-torch-topk/19170 | 2018-06-04T12:22:49.287000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Ignore dimension 0 when calculating mean\n\nIs there any way I can calculate the mean of all elements in a 4d tensor except along dim 0 - i.e. the equivalent of `tensor.mean(1).mean(1).mean(1)`?"
},
{
"role": "assistant",
"content": "if you know the size of the firs... | answer | 19,172 | https://discuss.pytorch.org/t/ignore-dimension-0-when-calculating-mean/19172 | 2018-06-04T12:45:59.833000Z | gold | verbatim | [
2
] | [
"alexis-jacq"
] |
[
{
"role": "user",
"content": "Reset model weights\n\nI would like to know, if there is a way to reset weights for a PyTorch model. \n\nHere is my code:\n\n```\nclass Net(nn.Module):\n def __init__(self):\n super(Net, self).__init__()\n self.conv1 = nn.Conv2d(1, 16, kernel_size=5)\n s... | answer | 19,180 | https://discuss.pytorch.org/t/reset-model-weights/19180 | 2018-06-04T15:05:39.913000Z | gold | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "DataLoader behaves the same at every epoch with np.random\n\n# DataLoader behaves the same at every epoch with np.random\n\nIn my code, I need to use `np.random.randint()` to random crop my data. \nHowevery, the random number generated at every epoch is the same. \nI think it s... | answer | 19,227 | https://discuss.pytorch.org/t/dataloader-behaves-the-same-at-every-epoch-with-np-random/19227 | 2018-06-05T13:15:39.418000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Using PyTorch Transformers\n\nHi,\n\nI'm using a set of transformers defined like this for the train_dataset:\n\n```\ndef train_transformer():\n \"\"\"\n Train transformer.\n :return: a transformer\n \"\"\"\n transformer = transforms.Compose([\n transforms... | answer | 19,284 | https://discuss.pytorch.org/t/using-pytorch-transformers/19284 | 2018-06-06T16:46:42.252000Z | silver | verbatim | [
6
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Error creating sample weights because dataset is too large\n\nI've been creating weighted sampling for a CNN by loading in the data and iterating through each item's labels as follows:\n\n```\n train_loader = DataLoader(Dataset(data_path, cube_length, transforms, img_size), ... | answer | 19,292 | https://discuss.pytorch.org/t/error-creating-sample-weights-because-dataset-is-too-large/19292 | 2018-06-06T18:15:56.967000Z | silver | verbatim | [
4
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Channelwise Threshold\n\nI am trying to apply a different threshold to each input channel (e.g., similar to PReLU with \\alpha set to nChannels), but the thresholds do not need to be learned. So far I have the following, but it is too slow due to the for loop.\n\n```\nclass Cha... | answer | 19,298 | https://discuss.pytorch.org/t/channelwise-threshold/19298 | 2018-06-06T21:05:49.553000Z | gold | verbatim | [
5
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "How do you determine the layer type?\n\nI want to iterate through the children() of a module, \nand identify all the convolutional layers (for instance), or maybe all the maxpool layers, to do something with them.\n\nHow can I determine the type of layer?\n\nMy code would be so... | answer | 19,309 | https://discuss.pytorch.org/t/how-do-you-determine-the-layer-type/19309 | 2018-06-07T01:09:28.868000Z | gold | verbatim | [
2
] | [
"reachtarunhere"
] |
[
{
"role": "user",
"content": "Getting model.parameters() as empty list\n\nI know it might be duplicate of many of the existing issues already here on this forum but I wasn't able to figure out problem with my code. I've reduced my intricate codebase to the following simple snippet.\n\n```\nclass Model(nn.Mo... | answer | 19,321 | https://discuss.pytorch.org/t/getting-model-parameters-as-empty-list/19321 | 2018-06-07T07:01:42.201000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Using a custom model as feature extractor\n\nI've a custom model which I've saved as model_dict (which I saved as a .pth file) after training. Now I want to use it as feature extractor. How can I do this? \n\n[network architecture](https://imgur.com/a/cZWU5ya)\n\nPlease see the... | answer | 19,325 | https://discuss.pytorch.org/t/using-a-custom-model-as-feature-extractor/19325 | 2018-06-07T07:45:41.007000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "File gets executed multiple times when using num_workers > 0 in torch.utils.data.DataLoader()\n\nI ran into a rather curious problem while trying to implement this [semi-supervised representation learning algorithm](https://arxiv.org/abs/1603.09246)\n\n(tl;dr Pretrain a CNN by ... | answer | 19,332 | https://discuss.pytorch.org/t/file-gets-executed-multiple-times-when-using-num-workers-0-in-torch-utils-data-dataloader/19332 | 2018-06-07T09:48:19.273000Z | gold | verbatim | [
3
] | [
"ptrblck"
] |
[
{
"role": "user",
"content": "Loaded network has different shape but works anyway\n\nI trained a model with among others had the following layer:\n`final_layer.append(nn.Conv2d(64, 1, kernel_size=1))`\nand then saved it to a file with state_dict and torch.save.\n\nThen, when I wanted to load that model usin... | answer | 19,398 | https://discuss.pytorch.org/t/loaded-network-has-different-shape-but-works-anyway/19398 | 2018-06-08T12:19:36.142000Z | gold | verbatim | [
2
] | [
"ptrblck"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.