cntk-proto.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. export const CNTK = {};
  2. CNTK.proto = {};
  3. CNTK.proto.NDShape = class NDShape {
  4. constructor() {
  5. this.shape_dim = [];
  6. }
  7. static decode(reader, length) {
  8. const message = new CNTK.proto.NDShape();
  9. const end = length === undefined ? reader.length : reader.position + length;
  10. while (reader.position < end) {
  11. const tag = reader.uint32();
  12. switch (tag >>> 3) {
  13. case 1:
  14. message.shape_dim = reader.array(message.shape_dim, () => reader.uint64(), tag);
  15. break;
  16. default:
  17. reader.skipType(tag & 7);
  18. break;
  19. }
  20. }
  21. return message;
  22. }
  23. };
  24. CNTK.proto.Axis = class Axis {
  25. static decode(reader, length) {
  26. const message = new CNTK.proto.Axis();
  27. const end = length === undefined ? reader.length : reader.position + length;
  28. while (reader.position < end) {
  29. const tag = reader.uint32();
  30. switch (tag >>> 3) {
  31. case 1:
  32. message.static_axis_idx = reader.int32();
  33. break;
  34. case 2:
  35. message.name = reader.string();
  36. break;
  37. case 3:
  38. message.is_ordered_dynamic_axis = reader.bool();
  39. break;
  40. default:
  41. reader.skipType(tag & 7);
  42. break;
  43. }
  44. }
  45. return message;
  46. }
  47. };
  48. CNTK.proto.Axis.prototype.static_axis_idx = 0;
  49. CNTK.proto.Axis.prototype.name = "";
  50. CNTK.proto.Axis.prototype.is_ordered_dynamic_axis = false;
  51. CNTK.proto.NDArrayView = class NDArrayView {
  52. get values() {
  53. CNTK.proto.NDArrayView.valuesSet = CNTK.proto.NDArrayView.valuesSet || new Set(["float_values", "double_values", "bytes_value", "sint32_values"]);
  54. return Object.keys(this).find((key) => CNTK.proto.NDArrayView.valuesSet.has(key) && this[key] !== null);
  55. }
  56. static decode(reader, length) {
  57. const message = new CNTK.proto.NDArrayView();
  58. const end = length === undefined ? reader.length : reader.position + length;
  59. while (reader.position < end) {
  60. const tag = reader.uint32();
  61. switch (tag >>> 3) {
  62. case 1:
  63. message.data_type = reader.int32();
  64. break;
  65. case 2:
  66. message.storage_format = reader.int32();
  67. break;
  68. case 3:
  69. message.shape = CNTK.proto.NDShape.decode(reader, reader.uint32());
  70. break;
  71. case 4:
  72. message.float_values = CNTK.proto.NDArrayView.FloatValues.decode(reader, reader.uint32());
  73. break;
  74. case 5:
  75. message.double_values = CNTK.proto.NDArrayView.DoubleValues.decode(reader, reader.uint32());
  76. break;
  77. case 6:
  78. message.bytes_value = CNTK.proto.NDArrayView.BytesValue.decode(reader, reader.uint32());
  79. break;
  80. case 7:
  81. message.sint32_values = CNTK.proto.NDArrayView.IntValues.decode(reader, reader.uint32());
  82. break;
  83. default:
  84. reader.skipType(tag & 7);
  85. break;
  86. }
  87. }
  88. return message;
  89. }
  90. };
  91. CNTK.proto.NDArrayView.prototype.data_type = 0;
  92. CNTK.proto.NDArrayView.prototype.storage_format = 0;
  93. CNTK.proto.NDArrayView.prototype.shape = null;
  94. CNTK.proto.NDArrayView.DataType = {
  95. "Unknown": 0,
  96. "Float": 1,
  97. "Double": 2,
  98. "Float16": 4,
  99. "Int8": 5,
  100. "Int16": 6
  101. };
  102. CNTK.proto.NDArrayView.StorageFormat = {
  103. "Dense": 0,
  104. "SparseCSC": 1,
  105. "SparseBlockCol": 2
  106. };
  107. CNTK.proto.NDArrayView.FloatValues = class FloatValues {
  108. constructor() {
  109. this.value = [];
  110. }
  111. static decode(reader, length) {
  112. const message = new CNTK.proto.NDArrayView.FloatValues();
  113. const end = length === undefined ? reader.length : reader.position + length;
  114. while (reader.position < end) {
  115. const tag = reader.uint32();
  116. switch (tag >>> 3) {
  117. case 1:
  118. message.value = reader.floats(message.value, tag);
  119. break;
  120. default:
  121. reader.skipType(tag & 7);
  122. break;
  123. }
  124. }
  125. return message;
  126. }
  127. };
  128. CNTK.proto.NDArrayView.DoubleValues = class DoubleValues {
  129. constructor() {
  130. this.value = [];
  131. }
  132. static decode(reader, length) {
  133. const message = new CNTK.proto.NDArrayView.DoubleValues();
  134. const end = length === undefined ? reader.length : reader.position + length;
  135. while (reader.position < end) {
  136. const tag = reader.uint32();
  137. switch (tag >>> 3) {
  138. case 1:
  139. message.value = reader.doubles(message.value, tag);
  140. break;
  141. default:
  142. reader.skipType(tag & 7);
  143. break;
  144. }
  145. }
  146. return message;
  147. }
  148. };
  149. CNTK.proto.NDArrayView.BytesValue = class BytesValue {
  150. static decode(reader, length) {
  151. const message = new CNTK.proto.NDArrayView.BytesValue();
  152. const end = length === undefined ? reader.length : reader.position + length;
  153. while (reader.position < end) {
  154. const tag = reader.uint32();
  155. switch (tag >>> 3) {
  156. case 1:
  157. message.value = reader.bytes();
  158. break;
  159. default:
  160. reader.skipType(tag & 7);
  161. break;
  162. }
  163. }
  164. return message;
  165. }
  166. };
  167. CNTK.proto.NDArrayView.BytesValue.prototype.value = new Uint8Array([]);
  168. CNTK.proto.NDArrayView.IntValues = class IntValues {
  169. constructor() {
  170. this.value = [];
  171. }
  172. static decode(reader, length) {
  173. const message = new CNTK.proto.NDArrayView.IntValues();
  174. const end = length === undefined ? reader.length : reader.position + length;
  175. while (reader.position < end) {
  176. const tag = reader.uint32();
  177. switch (tag >>> 3) {
  178. case 1:
  179. message.value = reader.array(message.value, () => reader.sint32(), tag);
  180. break;
  181. default:
  182. reader.skipType(tag & 7);
  183. break;
  184. }
  185. }
  186. return message;
  187. }
  188. };
  189. CNTK.proto.Vector = class Vector {
  190. constructor() {
  191. this.value = [];
  192. }
  193. static decode(reader, length) {
  194. const message = new CNTK.proto.Vector();
  195. const end = length === undefined ? reader.length : reader.position + length;
  196. while (reader.position < end) {
  197. const tag = reader.uint32();
  198. switch (tag >>> 3) {
  199. case 1:
  200. message.value.push(CNTK.proto.DictionaryValue.decode(reader, reader.uint32()));
  201. break;
  202. default:
  203. reader.skipType(tag & 7);
  204. break;
  205. }
  206. }
  207. return message;
  208. }
  209. };
  210. CNTK.proto.Dictionary = class Dictionary {
  211. constructor() {
  212. this.data = {};
  213. }
  214. static decode(reader, length) {
  215. const message = new CNTK.proto.Dictionary();
  216. const end = length === undefined ? reader.length : reader.position + length;
  217. while (reader.position < end) {
  218. const tag = reader.uint32();
  219. switch (tag >>> 3) {
  220. case 1:
  221. message.version = reader.uint64();
  222. break;
  223. case 2:
  224. reader.entry(message.data, () => reader.string(), () => CNTK.proto.DictionaryValue.decode(reader, reader.uint32()));
  225. break;
  226. default:
  227. reader.skipType(tag & 7);
  228. break;
  229. }
  230. }
  231. return message;
  232. }
  233. };
  234. CNTK.proto.Dictionary.prototype.version = 0n;
  235. CNTK.proto.DictionaryValue = class DictionaryValue {
  236. get value() {
  237. CNTK.proto.DictionaryValue.valueSet = CNTK.proto.DictionaryValue.valueSet || new Set(["bool_value", "int_value", "size_t_value", "float_value", "double_value", "string_value", "nd_shape_value", "axis_value", "vector_value", "dictionary_value", "nd_array_view_value"]);
  238. return Object.keys(this).find((key) => CNTK.proto.DictionaryValue.valueSet.has(key) && this[key] !== null);
  239. }
  240. static decode(reader, length) {
  241. const message = new CNTK.proto.DictionaryValue();
  242. const end = length === undefined ? reader.length : reader.position + length;
  243. while (reader.position < end) {
  244. const tag = reader.uint32();
  245. switch (tag >>> 3) {
  246. case 1:
  247. message.version = reader.uint64();
  248. break;
  249. case 2:
  250. message.value_type = reader.int32();
  251. break;
  252. case 3:
  253. message.bool_value = reader.bool();
  254. break;
  255. case 4:
  256. message.int_value = reader.int32();
  257. break;
  258. case 5:
  259. message.size_t_value = reader.uint64();
  260. break;
  261. case 6:
  262. message.float_value = reader.float();
  263. break;
  264. case 7:
  265. message.double_value = reader.double();
  266. break;
  267. case 8:
  268. message.string_value = reader.string();
  269. break;
  270. case 9:
  271. message.nd_shape_value = CNTK.proto.NDShape.decode(reader, reader.uint32());
  272. break;
  273. case 10:
  274. message.axis_value = CNTK.proto.Axis.decode(reader, reader.uint32());
  275. break;
  276. case 11:
  277. message.vector_value = CNTK.proto.Vector.decode(reader, reader.uint32());
  278. break;
  279. case 12:
  280. message.dictionary_value = CNTK.proto.Dictionary.decode(reader, reader.uint32());
  281. break;
  282. case 13:
  283. message.nd_array_view_value = CNTK.proto.NDArrayView.decode(reader, reader.uint32());
  284. break;
  285. default:
  286. reader.skipType(tag & 7);
  287. break;
  288. }
  289. }
  290. return message;
  291. }
  292. };
  293. CNTK.proto.DictionaryValue.prototype.version = 0n;
  294. CNTK.proto.DictionaryValue.prototype.value_type = 0;
  295. CNTK.proto.DictionaryValue.Type = {
  296. "None": 0,
  297. "Bool": 1,
  298. "Int": 2,
  299. "SizeT": 3,
  300. "Float": 4,
  301. "Double": 5,
  302. "String": 6,
  303. "NDShape": 7,
  304. "Axis": 8,
  305. "Vector": 9,
  306. "Dictionary": 10,
  307. "NDArrayView": 11
  308. };