ivy
ivy copied to clipboard
Update nn.py with conv_transpose function (#17990)
#17990 Created a conv_transpose function. I don't understand how many dimensions is it supposed to have (like 1 in Conv1D). So I added an n to pass this argument into the function. Please explain further the functionality that is supposed to be implemented as I could find any alike function in the TensorFlow documentation. Thanks!
If you are working on an open task, please edit the PR description to link to the issue you've created.
For more information, please check ToDo List Issues Guide.
Thank you :hugs:
Hi @ViktorTurchenko! Thank you for contributing to Ivy :hugs: 2 little things though:
- Please edit the PR description to correctly link an issue, you edited the title of the PR.
- In any case, a frontend must exactly match the framework's function signature. So you can't pass in a
n
argument here. Thisconv_transpose
would callconv1d_transpose
,conv2d_transpose
orconv3d_transpose
based solely on the data shape of the inputs passed in. You would have to inferinput
,filters
,data_format
ordilations
to get the correctN
that is specified in the function's documentation.
I have 3 more questions:
- If we are deciding which function to use with the
data_format
argument may I move it so it is a compulsory argument? - If no then what default value should I use (most users will get errors if they don't change and their data is not matching the format needed)?
- Should I check the 3-rd condition with a
elif
statement and for everything else raise some kind of an error? Thanks for your time!
- We will have to keep it exactly the same. Probably you shouldn't
if-else
on an Optional keyword argument. It says on the docs thatdata_format
depends on N being figured elsewhere (input
andfilters
):
For N=1, the valid values are "NWC" (default) and "NCW". For N=2, the valid values are "NHWC" (default) and "NCHW". For N=3, the valid values are "NDHWC" (default) and "NCDHW".
- Depends on required arguments.
- Yeah we should raise an
ivy.utils.exceptions.IvyException
if the inputs are wrong, don't default everything to anelse
in this case.
I changed the if-else
to a required argument and added the exception at the end. Sorry I haven't read the documentation enough to understand the required formats 😃
@handle_frontend_test(
fn_tree="tensorflow.nn.conv_transpose",
x_f_d_df=_x_and_filters(
dtypes=helpers.get_dtypes("float", full=False),
data_format=st.sampled_from(["NDHWC"]),
padding=st.sampled_from(["SAME"]),
type="3d",
transpose=True,
),
test_with_out=st.just(False),
)
For the frontend test part what type=
argument should be inserted?
For the frontend test part what
type=
argument should be inserted?
You're going to have to sample from 1d
, 2d
or 3d
as conv_transpose
is all 3 of them.
This PR has been labelled as stale because it has been inactive for more than 7 days. If you would like to continue working on this PR, then please add another comment or this PR will be closed in 7 days.
This PR has been closed because it has been marked as stale for more than 7 days with no activity.