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

1234567891011121314151617181920212223242526272829303132333435
  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. namespace Tensorflow.Keras.Layers
  10. {
  11. public class UpSampling2D : Layer
  12. {
  13. UpSampling2DArgs args;
  14. int[] size;
  15. string data_format;
  16. string interpolation => args.Interpolation;
  17. public UpSampling2D(UpSampling2DArgs args) : base(args)
  18. {
  19. this.args = args;
  20. data_format = conv_utils.normalize_data_format(args.DataFormat);
  21. size = conv_utils.normalize_tuple(args.Size, 2, "size");
  22. inputSpec = new InputSpec(ndim: 4);
  23. }
  24. protected override Tensors Call(Tensors inputs, Tensor mask = null, bool? training = null, Tensors initial_state = null, Tensors constants = null)
  25. {
  26. return keras.backend.resize_images(inputs,
  27. size[0], size[1],
  28. data_format,
  29. interpolation: interpolation);
  30. }
  31. }
  32. }