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.

UpSampling2D.cs 1.1 kB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Tensorflow.Keras.ArgsDefinition;
  5. using Tensorflow.Keras.Engine;
  6. using Tensorflow.Keras.Utils;
  7. using static Tensorflow.Binding;
  8. using static Tensorflow.KerasApi;
  9. using Tensorflow.Common.Types;
  10. namespace Tensorflow.Keras.Layers
  11. {
  12. public class UpSampling2D : Layer
  13. {
  14. UpSampling2DArgs args;
  15. int[] size;
  16. string data_format;
  17. string interpolation => args.Interpolation;
  18. public UpSampling2D(UpSampling2DArgs args) : base(args)
  19. {
  20. this.args = args;
  21. data_format = conv_utils.normalize_data_format(args.DataFormat);
  22. size = conv_utils.normalize_tuple(args.Size, 2, "size");
  23. inputSpec = new InputSpec(ndim: 4);
  24. }
  25. protected override Tensors Call(Tensors inputs, Tensors state = null, bool? training = null, IOptionalArgs? optional_args = null)
  26. {
  27. return keras.backend.resize_images(inputs,
  28. size[0], size[1],
  29. data_format,
  30. interpolation: interpolation);
  31. }
  32. }
  33. }