-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convolution #2
Comments
1D convolutions are done. We should change this request to be 2D convolutions. |
Hi, I came across kayak looking for a quick way to implement a convolution network in Python. I have a few questions about your 1d convolution implementation: 1.) What is the 1d convolution you are implementing? Since A and B are allowed to be higher dimensional I assumed it was supposed to compute the row-by-row convolution of the respective tensors, but when ncolors is set to 1, this appears not to be the case - it just computes the matrix product of A and B. 2.) The output of the _local_grad operation appears to have the same dimensionality as the inputs. Shouldn't it be greater? The gradient of a function from R^n x R^n to R^n by the first (weight) parameter should live in R^2n. In the case that A and B are matrices, the gradient with respect to A should be 4-dimensional, but _local_grad returns a matrix. My apologies if these are dumb questions - I'm a mathematician with very minimal programming experience. Thanks for your consideration, |
Hi Shawn, sorry the documentation could be much better here (and I should change the word colors to maybe "channels" instead) The input should be of the form NxD where N is the number of examples (e.g. training cases) and D is the dimensionality of the input (length of the sequence) times the number of channels. The convolution is then applied N times along the 2nd dimension (i.e. over the D dimensional input). When there are multiple input channels (e.g. analogous to multiple colors in the 2D convolution case) we assume that they are stacked horizontally in the second dimension (i.e. [first channel, second channel, ..., etc.]) such that you could reshape the inputs to be a tensor of shape (N, nchannels, D) and then the convolution of a nchannel x filter_size filter is applied along the D dimension. Local_grad returns the matrix of the partial derivatives of the inputs (self.A or self.B) with respect to the output of the function, so it will return the gradient w.r.t. each element in the input (thus be the same size as the input). Hope that helps! Jasper |
Hi, I'm sorry, but I still don't understand. If I explain what I want to do, can you tell me if Convolve1d can do it, and if so, how? What I want to do is input a kxm matrix A, which I think of as a list of m column vectors of length k, and a kxn matrix B, which I think of as a list of k row filters of length n (where generally n < m). I want the output to be the wide row by row convolution of A by B, that is, the kx(m+n-1) matrix whose ith row is the wide 1d convolution A[i,:]*B[i,:]. Is this possible? Thanks, |
Shawn, you should check out autograd: https://github.com/HIPS/autograd. Best, Jasper On Mon, Apr 13, 2015 at 4:13 PM, shawnjhenry [email protected]
|
Thanks, I'll have a look. Shawn |
No description provided.
The text was updated successfully, but these errors were encountered: