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.

Layer.cs 13 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  1. using NumSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using Tensorflow;
  5. using Tensorflow.Keras.Constraints;
  6. using Tensorflow.Keras.Initializers;
  7. using Tensorflow.Keras.Losses;
  8. using Tensorflow.Keras.Metrics;
  9. using Tensorflow.Keras.Regularizers;
  10. namespace Keras.Layers
  11. {
  12. public abstract class Layer
  13. {
  14. public TF_DataType dtype
  15. {
  16. get
  17. {
  18. throw new NotImplementedException();
  19. }
  20. }
  21. public string name
  22. {
  23. get
  24. {
  25. throw new NotImplementedException();
  26. }
  27. }
  28. public bool stateful
  29. {
  30. get
  31. {
  32. throw new NotImplementedException();
  33. }
  34. set
  35. {
  36. throw new NotImplementedException();
  37. }
  38. }
  39. public bool trainable
  40. {
  41. get
  42. {
  43. throw new NotImplementedException();
  44. }
  45. }
  46. public Regularizer activity_regularizer
  47. {
  48. get
  49. {
  50. throw new NotImplementedException();
  51. }
  52. set
  53. {
  54. throw new NotImplementedException();
  55. }
  56. }
  57. public dynamic input_spec
  58. {
  59. get
  60. {
  61. throw new NotImplementedException();
  62. }
  63. set
  64. {
  65. throw new NotImplementedException();
  66. }
  67. }
  68. public Tensor[] trainable_weights
  69. {
  70. get
  71. {
  72. throw new NotImplementedException();
  73. }
  74. }
  75. public Tensor[] non_trainable_weights
  76. {
  77. get
  78. {
  79. throw new NotImplementedException();
  80. }
  81. }
  82. private Tensor[] _weights
  83. {
  84. get
  85. {
  86. throw new NotImplementedException();
  87. }
  88. }
  89. public Func<bool>[] updates
  90. {
  91. get
  92. {
  93. throw new NotImplementedException();
  94. }
  95. }
  96. public Tensor[] losses
  97. {
  98. get
  99. {
  100. throw new NotImplementedException();
  101. }
  102. }
  103. public Tensor[] metrics
  104. {
  105. get
  106. {
  107. throw new NotImplementedException();
  108. }
  109. }
  110. public Tensor[] input_mask
  111. {
  112. get
  113. {
  114. throw new NotImplementedException();
  115. }
  116. }
  117. public Tensor[] output_mask
  118. {
  119. get
  120. {
  121. throw new NotImplementedException();
  122. }
  123. }
  124. public Tensor[] input
  125. {
  126. get
  127. {
  128. throw new NotImplementedException();
  129. }
  130. }
  131. public Tensor[] output
  132. {
  133. get
  134. {
  135. throw new NotImplementedException();
  136. }
  137. }
  138. public TensorShape[] input_shape
  139. {
  140. get
  141. {
  142. throw new NotImplementedException();
  143. }
  144. }
  145. public TensorShape[] output_shape
  146. {
  147. get
  148. {
  149. throw new NotImplementedException();
  150. }
  151. }
  152. public Tensor[] variables
  153. {
  154. get
  155. {
  156. return _weights;
  157. }
  158. }
  159. public Tensor[] trainable_variables
  160. {
  161. get
  162. {
  163. return trainable_weights;
  164. }
  165. }
  166. public Tensor[] non_trainable_variables
  167. {
  168. get
  169. {
  170. return non_trainable_weights;
  171. }
  172. }
  173. private string _compute_dtype
  174. {
  175. get
  176. {
  177. throw new NotImplementedException();
  178. }
  179. }
  180. public Layer(bool trainable = true, string name = null, string dtype = null, bool @dynamic = false, Dictionary<string, object> kwargs = null)
  181. {
  182. }
  183. public void build(TensorShape shape) => throw new NotImplementedException();
  184. public virtual void call(Tensor[] inputs) => throw new NotImplementedException();
  185. public void _add_trackable(dynamic trackable_object, bool trainable) => throw new NotImplementedException();
  186. public void add_weight(string name= null, TensorShape shape= null, string dtype= null, Initializer initializer = null,
  187. Regularizer regularizer = null, bool? trainable = null, ConstraintBase constraint = null,
  188. dynamic partitioner= null, bool? use_resource= null, VariableSynchronization synchronization= VariableSynchronization.Auto,
  189. VariableAggregation aggregation= VariableAggregation.None, Dictionary<string, object> kwargs = null) => throw new NotImplementedException();
  190. public virtual Dictionary<string, object> get_config() => throw new NotImplementedException();
  191. public Layer from_config(Dictionary<string, object> config) => throw new NotImplementedException();
  192. public TensorShape compute_output_shape(TensorShape input_shape) => throw new NotImplementedException();
  193. public dynamic compute_output_signature(dynamic input_signature) => throw new NotImplementedException();
  194. public Tensor[] compute_mask(Tensor[] inputs, Tensor[] mask = null) => throw new NotImplementedException();
  195. public void __call__(Tensor[] inputs) => throw new NotImplementedException();
  196. public void add_loss(Loss[] losses, Tensor[] inputs = null) => throw new NotImplementedException();
  197. public void _clear_losses() => throw new NotImplementedException();
  198. public void add_metric(Tensor value, string aggregation= null, string name= null) => throw new NotImplementedException();
  199. public void add_update(Func<bool>[] updates) => throw new NotImplementedException();
  200. public void set_weights(NDArray[] weights) => throw new NotImplementedException();
  201. public NDArray[] get_weights() => throw new NotImplementedException();
  202. public Func<bool>[] get_updates_for(Tensor[] inputs) => throw new NotImplementedException();
  203. public Tensor[] get_losses_for(Tensor[] inputs) => throw new NotImplementedException();
  204. public Tensor[] get_input_mask_at(int node_index) => throw new NotImplementedException();
  205. public Tensor[] get_output_mask_at(int node_index) => throw new NotImplementedException();
  206. public TensorShape[] get_input_shape_at(int node_index) => throw new NotImplementedException();
  207. public TensorShape[] get_output_shape_at(int node_index) => throw new NotImplementedException();
  208. public Tensor[] get_input_at(int node_index) => throw new NotImplementedException();
  209. public Tensor[] get_output_at(int node_index) => throw new NotImplementedException();
  210. public int count_params() => throw new NotImplementedException();
  211. private void _set_dtype_policy(string dtype) => throw new NotImplementedException();
  212. private Tensor _maybe_cast_inputs(Tensor inputs) => throw new NotImplementedException();
  213. private void _warn_about_input_casting(string input_dtype) => throw new NotImplementedException();
  214. private string _name_scope()
  215. {
  216. return name;
  217. }
  218. private string _obj_reference_counts
  219. {
  220. get
  221. {
  222. throw new NotImplementedException();
  223. }
  224. }
  225. private dynamic _attribute_sentinel
  226. {
  227. get
  228. {
  229. throw new NotImplementedException();
  230. }
  231. }
  232. private dynamic _call_full_argspec
  233. {
  234. get
  235. {
  236. throw new NotImplementedException();
  237. }
  238. }
  239. private string[] _call_fn_args
  240. {
  241. get
  242. {
  243. throw new NotImplementedException();
  244. }
  245. }
  246. private string[] _call_accepts_kwargs
  247. {
  248. get
  249. {
  250. throw new NotImplementedException();
  251. }
  252. }
  253. private bool _should_compute_mask
  254. {
  255. get
  256. {
  257. throw new NotImplementedException();
  258. }
  259. }
  260. private Tensor[] _eager_losses
  261. {
  262. get
  263. {
  264. throw new NotImplementedException();
  265. }
  266. set
  267. {
  268. throw new NotImplementedException();
  269. }
  270. }
  271. private dynamic _trackable_saved_model_saver
  272. {
  273. get
  274. {
  275. throw new NotImplementedException();
  276. }
  277. }
  278. private string _object_identifier
  279. {
  280. get
  281. {
  282. throw new NotImplementedException();
  283. }
  284. }
  285. private string _tracking_metadata
  286. {
  287. get
  288. {
  289. throw new NotImplementedException();
  290. }
  291. }
  292. public Dictionary<string, bool> state
  293. {
  294. get
  295. {
  296. throw new NotImplementedException();
  297. }
  298. set
  299. {
  300. throw new NotImplementedException();
  301. }
  302. }
  303. private void _init_set_name(string name, bool zero_based= true) => throw new NotImplementedException();
  304. private Metric _get_existing_metric(string name = null) => throw new NotImplementedException();
  305. private void _eager_add_metric(Metric value, string aggregation= null, string name= null) => throw new NotImplementedException();
  306. private void _symbolic_add_metric(Metric value, string aggregation = null, string name = null) => throw new NotImplementedException();
  307. private void _handle_weight_regularization(string name, VariableV1 variable, Regularizer regularizer) => throw new NotImplementedException();
  308. private void _handle_activity_regularization(Tensor[] inputs, Tensor[] outputs) => throw new NotImplementedException();
  309. private void _set_mask_metadata(Tensor[] inputs, Tensor[] outputs, Tensor previous_mask) => throw new NotImplementedException();
  310. private Tensor[] _collect_input_masks(Tensor[] inputs, Dictionary<string, object> args, Dictionary<string, object> kwargs) => throw new NotImplementedException();
  311. private bool _call_arg_was_passed(string arg_name, Dictionary<string, object> args, Dictionary<string, object> kwargs, bool inputs_in_args= false) => throw new NotImplementedException();
  312. private T _get_call_arg_value<T>(string arg_name, Dictionary<string, object> args, Dictionary<string, object> kwargs, bool inputs_in_args = false) => throw new NotImplementedException();
  313. private (Tensor[], Tensor[]) _set_connectivity_metadata_(Tensor[] inputs, Tensor[] outputs, Dictionary<string, object> args, Dictionary<string, object> kwargs) => throw new NotImplementedException();
  314. private void _add_inbound_node(Tensor[] input_tensors, Tensor[] output_tensors, Dictionary<string, object> args = null) => throw new NotImplementedException();
  315. private AttrValue _get_node_attribute_at_index(int node_index, string attr, string attr_name) => throw new NotImplementedException();
  316. private void _maybe_build(Tensor[] inputs) => throw new NotImplementedException();
  317. private void _symbolic_call(Tensor[] inputs) => throw new NotImplementedException();
  318. private Dictionary<Layer, bool> _get_trainable_state() => throw new NotImplementedException();
  319. private void _set_trainable_state(bool trainable_state) => throw new NotImplementedException();
  320. private void _maybe_create_attribute(string name, object default_value) => throw new NotImplementedException();
  321. private void __delattr__(string name) => throw new NotImplementedException();
  322. private void __setattr__(string name, object value) => throw new NotImplementedException();
  323. private List<AttrValue> _gather_children_attribute(string attribute) => throw new NotImplementedException();
  324. private List<Layer> _gather_unique_layers() => throw new NotImplementedException();
  325. private List<Layer> _gather_layers() => throw new NotImplementedException();
  326. private bool _is_layer() => throw new NotImplementedException();
  327. private void _init_call_fn_args() => throw new NotImplementedException();
  328. public dynamic _list_extra_dependencies_for_serialization(dynamic serialization_cache) => throw new NotImplementedException();
  329. public dynamic _list_functions_for_serialization(dynamic serialization_cache) => throw new NotImplementedException();
  330. }
  331. }