Open
Description
Description
When loading a model saved from python, it looks like it cannot find the constructor for Tensorflow.Keras.Layers.ZeroPadding2D
owing to the fact that the single constructor that does exist has an additional optional parameter.
Reproduction Steps
Train and save a model in python: model.save('chart_type_classifier.model', save_format='tf')
Load the model in TensoFlow.Keras in c# .net
System.MissingMethodException
HResult=0x80131513
Message=Constructor on type 'Tensorflow.Keras.Layers.ZeroPadding2D' not found.
Source=System.Private.CoreLib
StackTrace:
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
Code where it blows up:
object obj2 = Assembly.Load("Tensorflow.Keras").CreateInstance("Tensorflow.Keras.Layers." + class_name, ignoreCase: true, BindingFlags.Default, null, new object[1] { obj }, null, null);
Note single argument.
Constructor that should be used but cannot be found owing to additional optional parameter:
public ZeroPadding2D(ZeroPadding2DArgs args, string data_format = null)
: base((LayerArgs) args)
{
this.data_format = conv_utils.normalize_data_format(data_format);
this.padding = args.Padding;
this.input_spec = new InputSpec(ndim: new int?(4));
}
Known Workarounds
No response
Configuration and Other Information
No response
Metadata
Metadata
Assignees
Labels
No labels