Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG Report]: Conv2DTranspose not working as expected #1012

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

Closed
PhasonMatrix opened this issue Mar 26, 2023 · 5 comments
Closed

[BUG Report]: Conv2DTranspose not working as expected #1012

PhasonMatrix opened this issue Mar 26, 2023 · 5 comments

Comments

@PhasonMatrix
Copy link

Description

I am implementing a U-Net convolutional network. I have some working Python code which I am now translating over to C#. When I try to use Tensorflow.Keras.ILayer.Conv2DTranspose() I have encountered two problems.

Problem 1: If I don't include the activation parameter, or set the activation parameter to null, I get an ArgumentNullException, with the exception message as "Value cannot be null. (Parameter 'key')". The activation parameter has a default value of null so it should be okay with this value. In my python code I do not get any error when not including a value for this parameter. Also, the error message says that the missing parameter is called 'key', which is incorrect, or maybe it's referring to some other parameter further down the call stack.

Example code:
var u6Transpose = keras.layers.Conv2DTranspose(128, kernel_size: (2, 2), strides: (2, 2), output_padding: "same");

Problem 2: After successfully constructing a Conv2DTranspose object, when calling the Apply() method, I get a NotImplementedException.

Example code:
var u6Tensor = u6Transpose.Apply(c5PostDropout);

Please let me know if this is not the correct way to use this layer. I have not found any example code online.

Reproduction Steps

No response

Known Workarounds

No response

Configuration and Other Information

.Net 6.0
Compile target: x64

NuGet packages:
TensorFlow.NET 0.100.4
TensorFlow.Keras 0.10.4
SciSharp.TensorFlow.Redist 2.11.0

@PhasonMatrix
Copy link
Author

Regarding Problem 1. I think I know why the error message says the parameter name is 'key'. In Activations.cs: line 80, Activations.GetActivationFromName() passes the name to _nameActivationMap.TryGetValue(). _nameActivationMap is a dictionary, and so doesn't like you trying to get a value with a null key. Maybe Activations.GetActivationFromName() should return null if the name parameter is null.

@PhasonMatrix
Copy link
Author

PhasonMatrix commented Jun 20, 2023

@lingbai-kong, Thanks for working on this. I have tested again with nightly build to see if the problem has been fixed. Unfortunately it has not. Problem 2 is still behaving the same. I can see that there is a fix for calling len() on KerasShapesWrapper (#1078), but I am still getting the exception "Message=len() not implemented for type: Tensorflow.Keras.Saving.KerasShapesWrapper". Should the nightly build "0.100.5-BERT-load-33-g89f3b238-nightly" have the fix?

@lingbai-kong
Copy link
Contributor

No, that nightly build hasn't included the fix. I think the next version will release the bug-fixing commit.

@PhasonMatrix
Copy link
Author

@lingbai-kong okay, no problem. Thanks for the reply.

@PhasonMatrix
Copy link
Author

PhasonMatrix commented Jun 27, 2023

I just upgraded to version 0.110.0 using NuGet package manager. I can confirm issue is no longer present. I can compile a model containing a Transpose layer without error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants