You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG Report]: Conv2DTranspose not working as expected #1012
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.
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.
@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?
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.
Activity
PhasonMatrix commentedon Mar 28, 2023
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. MaybeActivations.GetActivationFromName()should return null if thenameparameter is null.PhasonMatrix commentedon 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 commentedon Jun 21, 2023
No, that nightly build hasn't included the fix. I think the next version will release the bug-fixing commit.
PhasonMatrix commentedon Jun 21, 2023
@lingbai-kong okay, no problem. Thanks for the reply.
PhasonMatrix commentedon 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.