I have Two Tensors
I am trying to gather one from each row with the column being specified by these indices. So I am trying to get:
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1]
This is my code for this:
self.manDistMat.gather(1, state.unsqueeze(-1)))
self.manDistMat
being the 16x16 matrix and state.unsqueeze(-1) being the other matrix.
When I try this I get this error.
RuntimeError: index 578437695752307201 is out of bounds for dimension 1 with size 16
What am I doing wrong?
I actually figured out it was cause I was indexing with a uint8 tensor. When I switched it to with .long() it worked. Can anyone explain why it has to be a long tensor?
I encountered the similar problem. It appears to be a bug in pytorch.
Related
I am trying to use Pytorch Geometric on my own custom Dataset. However I keep getting this error "Please ensure that all indices in 'edge_index' point to valid indices in the interval [0, 13) in your node feature matrix and try again."
I checked that the max of edge_index is not greater than the number of nodes. Can anyone explain whats happening?
I have tried redoing my adjacency and edge_index matrices and I don't have this problem on InMemory datasets. Since I am making my own dataset, I see this error!
My question is related to plotting amplitude spectrum.
Problem 1: (I have solved it) I have to represent the following function as a discrete set of N=100 numbers separated by time increment of 1/N:
e(t) = 3sin2.1t + 2sin1.9t
I did it using stem function in matlab and plotted it.
Problem 2: (I have question about it) The next thing was to repeat the same above all, using dataset of 200 points with time increment of 1/N and 1/2N.
My question is a bit basic but I just want to clear if I am following the right path to solve my problem.
I want to ask that for problem 2, for both 1/N and 1/2N, should I use N=200 (as I believe it is separate problem)?
A few of my mates have suggested using N=100 for 1/N and N=200 for 1/2N.
which one is the right thing?
Any help will be highly appreciated. Thanks
I need to compute the 1D fft of a cx_mat in it's second dimension. So say I have this matrix:
cx_mat A(randu(5,10),randu(5,10));
The MATLAB version would look like:
A_fft=fft(A,[],2);
How would I go about this in Armadillo?
I'm trying to keep this as fast as possible so I figure a for loop running through the columns would not be the best option.
I then saw the .each_col attribute and tried
cx_mat A_fft=A.each_col([](vec& a){fft(a);});
But that would not compile. Maybe that is correct but my syntax is wrong
Any help would be greatly appreciated.
You need to have a complex vector as argument in the lambda function:
cx_mat A_fft=A.each_col([](cx_vec& a){fft(a);});
I am using the arima function in R's forecast package and I get the following error:
Error in solve.default(res$hessian*n.used,A): 'a' must be a complex matrix
The time series that I am fitting has very large values numbers e.g. greater than 10 million. Can anyone please provide a solution that might alleviate this error? Would scaling the time series help?
I have a kind of euclidean loss function which is:
\sum_{i,j} c_i*max{0,y_{ji}-k_{ji}} + p_i*max{0,k_{ji}-y_{ji}}
which y_{ji} are the output of caffe and k_{ji} are the real output value, i is the index of the items and j is index of samples.
The issue is about getting the values of parameters c_i and p_i.
When I have c_i = c_q for all i \neq q, and similarly for p_i, I simply get the values of them as parameters of the loss layer (I added two new parameters in the caffe.proto). However, the problems is that now I have around 300 items so that it is not reasonable to get them as loss layer parameters.
I tried to get their values in the loss layer, I mean I tried to add another bottom layer for loss layer, but it gave an error.
I am stuck here!
Please guide me how I can solve this issue.
Thanks in advance,
Afshin