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.

Model.Compile.cs 1.4 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using System;
  2. using Tensorflow.Keras.ArgsDefinition;
  3. using Tensorflow.Keras.Losses;
  4. using Tensorflow.Keras.Optimizers;
  5. namespace Tensorflow.Keras.Engine
  6. {
  7. public partial class Model
  8. {
  9. LossesContainer compiled_loss;
  10. MetricsContainer compiled_metrics;
  11. public void compile(ILossFunc loss, OptimizerV2 optimizer, string[] metrics)
  12. {
  13. this.optimizer = optimizer;
  14. compiled_loss = new LossesContainer(loss, output_names: output_names);
  15. compiled_metrics = new MetricsContainer(metrics, output_names: output_names);
  16. int experimental_steps_per_execution = 1;
  17. _configure_steps_per_execution(experimental_steps_per_execution);
  18. // Initialize cache attrs.
  19. _reset_compile_cache();
  20. _is_compiled = true;
  21. this.loss = loss;
  22. }
  23. public void compile(string optimizer, string loss, string[] metrics)
  24. {
  25. switch (optimizer)
  26. {
  27. case "rmsprop":
  28. this.optimizer = new RMSprop(new RMSpropArgs
  29. {
  30. });
  31. break;
  32. }
  33. int experimental_steps_per_execution = 1;
  34. _configure_steps_per_execution(experimental_steps_per_execution);
  35. _reset_compile_cache();
  36. _is_compiled = true;
  37. }
  38. }
  39. }