You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ZeroPadding2D.cs 1.6 kB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using Tensorflow.NumPy;
  2. using Tensorflow.Keras.ArgsDefinition;
  3. using Tensorflow.Keras.Engine;
  4. using Tensorflow.Keras.Utils;
  5. using Tensorflow.Common.Types;
  6. using static Tensorflow.KerasApi;
  7. namespace Tensorflow.Keras.Layers
  8. {
  9. /// <summary>
  10. /// Zero-padding layer for 2D input (e.g. picture).
  11. ///
  12. /// This layer can add rows and columns of zeros
  13. /// at the top, bottom, left and right side of an image tensor.
  14. /// </summary>
  15. public class ZeroPadding2D : Layer
  16. {
  17. string data_format;
  18. NDArray padding;
  19. InputSpec input_spec;
  20. public ZeroPadding2D(ZeroPadding2DArgs args, string data_format = null)
  21. : base(args)
  22. {
  23. this.data_format = conv_utils.normalize_data_format(data_format);
  24. this.padding = args.Padding;
  25. this.input_spec = new InputSpec(ndim: 4);
  26. }
  27. <<<<<<< HEAD
  28. <<<<<<< HEAD
  29. protected override Tensors Call(Tensors inputs, Tensors state = null, bool? training = null, IOptionalArgs? optional_args = null)
  30. =======
  31. protected override Tensors Call(Tensors inputs, Tensor mask = null, bool? training = null, Tensors initial_state = null, Tensors constants = null)
  32. >>>>>>> master
  33. =======
  34. protected override Tensors Call(Tensors inputs, Tensors state = null, bool? training = null, IOptionalArgs? optional_args = null)
  35. >>>>>>> 90a65d7d98b92f26574ac32392ed802a57d4d2c8
  36. {
  37. return keras.backend.spatial_2d_padding(inputs,
  38. padding: padding,
  39. data_format: data_format);
  40. }
  41. }
  42. }