Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix issue where ndims was incorrectly used to calculate shape of input #3277

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

Merged
merged 1 commit into from
Sep 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions 22 src/api/c/convolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,17 @@ af_err af_convolve2_nn(af_array *out, const af_array signal,

const af_dtype signalType = sInfo.getType();

ARG_ASSERT(3, stride_dims > 0 && stride_dims <= 2);
ARG_ASSERT(5, padding_dims > 0 && padding_dims <= 2);
ARG_ASSERT(7, dilation_dims > 0 && dilation_dims <= 2);

dim4 stride(stride_dims, strides);
dim4 padding(padding_dims, paddings);
dim4 dilation(dilation_dims, dilations);

size_t stride_ndims = stride.ndims();
size_t padding_ndims = padding.ndims();
size_t dilation_ndims = dilation.ndims();
ARG_ASSERT(3, stride_ndims > 0 && stride_ndims <= 2);
ARG_ASSERT(5, padding_ndims >= 0 && padding_ndims <= 2);
ARG_ASSERT(7, dilation_ndims > 0 && dilation_ndims <= 2);

// assert number of features matches between signal and filter
DIM_ASSERT(1, sDims[2] == fDims[2]);

Expand Down Expand Up @@ -424,14 +427,17 @@ af_err af_convolve2_gradient_nn(

af_array output;

ARG_ASSERT(3, stride_dims > 0 && stride_dims <= 2);
ARG_ASSERT(5, padding_dims > 0 && padding_dims <= 2);
ARG_ASSERT(7, dilation_dims > 0 && dilation_dims <= 2);

af::dim4 stride(stride_dims, strides);
af::dim4 padding(padding_dims, paddings);
af::dim4 dilation(dilation_dims, dilations);

size_t stride_ndims = stride.ndims();
size_t padding_ndims = padding.ndims();
size_t dilation_ndims = dilation.ndims();
ARG_ASSERT(3, stride_ndims > 0 && stride_ndims <= 2);
ARG_ASSERT(5, padding_ndims > 0 && padding_ndims <= 2);
ARG_ASSERT(7, dilation_ndims > 0 && dilation_ndims <= 2);

af_dtype type = oinfo.getType();
switch (type) {
case f32:
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.