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.

tf.train.cs 2.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*****************************************************************************
  2. Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ******************************************************************************/
  13. using System.Collections.Generic;
  14. using Tensorflow.Train;
  15. namespace Tensorflow
  16. {
  17. public partial class tensorflow
  18. {
  19. public train_internal train { get; } = new train_internal();
  20. public class train_internal
  21. {
  22. public Optimizer GradientDescentOptimizer(float learning_rate)
  23. => new GradientDescentOptimizer(learning_rate);
  24. public Optimizer AdamOptimizer(float learning_rate, string name = "Adam")
  25. => new AdamOptimizer(learning_rate, name: name);
  26. public object ExponentialMovingAverage(float decay)
  27. => new ExponentialMovingAverage(decay);
  28. public Saver Saver(VariableV1[] var_list = null) => new Saver(var_list: var_list);
  29. public string write_graph(Graph graph, string logdir, string name, bool as_text = true)
  30. => graph_io.write_graph(graph, logdir, name, as_text);
  31. public Saver import_meta_graph(string meta_graph_or_file,
  32. bool clear_devices = false,
  33. string import_scope = "") => saver._import_meta_graph_with_return_elements(meta_graph_or_file,
  34. clear_devices,
  35. import_scope).Item1;
  36. public (MetaGraphDef, Dictionary<string, RefVariable>) export_meta_graph(string filename = "",
  37. bool as_text = false,
  38. bool clear_devices = false,
  39. bool clear_extraneous_savers = false,
  40. bool strip_default_attrs = false) => meta_graph.export_scoped_meta_graph(filename: filename,
  41. as_text: as_text,
  42. clear_devices: clear_devices,
  43. clear_extraneous_savers: clear_extraneous_savers,
  44. strip_default_attrs: strip_default_attrs);
  45. }
  46. }
  47. }