[BUG Report]: Conv2DTranspose not working as expected
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
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?
No, that nightly build hasn't included the fix. I think the next version will release the bug-fixing commit.
@lingbai-kong okay, no problem. Thanks for the reply.
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.