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.

Merge.cs 1.0 kB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using static Tensorflow.Binding;
  5. using Tensorflow.Keras.ArgsDefinition;
  6. using Tensorflow.Keras.Engine;
  7. using Tensorflow.Keras.Saving;
  8. namespace Tensorflow.Keras.Layers
  9. {
  10. public abstract class Merge : Layer
  11. {
  12. public Merge(MergeArgs args) : base(args)
  13. {
  14. }
  15. public override void build(KerasShapesWrapper input_shape)
  16. {
  17. // output_shape = input_shape.dims[1^];
  18. _buildInputShape = input_shape;
  19. }
  20. protected override Tensors Call(Tensors inputs, Tensor mask = null, bool? training = null, Tensors initial_state = null, Tensors constants = null)
  21. {
  22. return _merge_function(inputs);
  23. }
  24. protected virtual Tensors _merge_function(Tensors inputs)
  25. {
  26. var output = inputs[0];
  27. foreach (var i in range(1, inputs.Length))
  28. output += inputs[i];
  29. return output;
  30. }
  31. }
  32. }