-
Notifications
You must be signed in to change notification settings - Fork 2
/
tensorflow.php
585 lines (422 loc) · 17.9 KB
/
tensorflow.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
<?php
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.12
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
// Try to load our extension if it's not already loaded.
if (!extension_loaded('tensorflow')) {
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
if (!dl('php_tensorflow.dll')) return;
} else {
// PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
if (PHP_SHLIB_SUFFIX === 'dylib') {
if (!dl('tensorflow.so')) return;
} else {
if (!dl('tensorflow.'.PHP_SHLIB_SUFFIX)) return;
}
}
}
abstract class tensorflow {
static function TF_NewStatus() {
return TF_NewStatus();
}
static function TF_DeleteStatus($arg1) {
TF_DeleteStatus($arg1);
}
static function TF_SetStatus($s,$code,$msg) {
TF_SetStatus($s,$code,$msg);
}
static function TF_GetCode($s) {
return TF_GetCode($s);
}
static function TF_Message($s) {
return TF_Message($s);
}
static function TF_NewBufferFromString($proto,$proto_len) {
return TF_NewBufferFromString($proto,$proto_len);
}
static function TF_NewBuffer() {
return TF_NewBuffer();
}
static function TF_DeleteBuffer($arg1) {
TF_DeleteBuffer($arg1);
}
static function TF_GetBuffer($buffer) {
return TF_GetBuffer($buffer);
}
static function TF_NewTensor($arg1,$dims,$num_dims,$data,$len,$deallocator,$deallocator_arg) {
return TF_NewTensor($arg1,$dims,$num_dims,$data,$len,$deallocator,$deallocator_arg);
}
static function TF_AllocateTensor($arg1,$dims,$num_dims,$len) {
return TF_AllocateTensor($arg1,$dims,$num_dims,$len);
}
static function TF_DeleteTensor($arg1) {
TF_DeleteTensor($arg1);
}
static function TF_TensorType($arg1) {
return TF_TensorType($arg1);
}
static function TF_NumDims($arg1) {
return TF_NumDims($arg1);
}
static function TF_Dim($tensor,$dim_index) {
return TF_Dim($tensor,$dim_index);
}
static function TF_TensorByteSize($arg1) {
return TF_TensorByteSize($arg1);
}
static function TF_TensorData($arg1) {
return TF_TensorData($arg1);
}
static function TF_StringEncode($src,$src_len,$dst,$dst_len,$status) {
return TF_StringEncode($src,$src_len,$dst,$dst_len,$status);
}
static function TF_StringDecode($src,$src_len,$dst,$dst_len,$status) {
return TF_StringDecode($src,$src_len,$dst,$dst_len,$status);
}
static function TF_StringEncodedSize($len) {
return TF_StringEncodedSize($len);
}
static function TF_NewSessionOptions() {
return TF_NewSessionOptions();
}
static function TF_SetTarget($options,$target) {
TF_SetTarget($options,$target);
}
static function TF_SetConfig($options,$proto,$proto_len,$status) {
TF_SetConfig($options,$proto,$proto_len,$status);
}
static function TF_DeleteSessionOptions($arg1) {
TF_DeleteSessionOptions($arg1);
}
static function TF_NewGraph() {
return TF_NewGraph();
}
static function TF_DeleteGraph($arg1) {
TF_DeleteGraph($arg1);
}
static function TF_GraphSetTensorShape($graph,$output,$dims,$num_dims,$status) {
TF_GraphSetTensorShape($graph,$output,$dims,$num_dims,$status);
}
static function TF_GraphGetTensorNumDims($graph,$output,$status) {
return TF_GraphGetTensorNumDims($graph,$output,$status);
}
static function TF_GraphGetTensorShape($graph,$output,$dims,$num_dims,$status) {
TF_GraphGetTensorShape($graph,$output,$dims,$num_dims,$status);
}
static function TF_NewOperation($graph,$op_type,$oper_name) {
return TF_NewOperation($graph,$op_type,$oper_name);
}
static function TF_SetDevice($desc,$device) {
TF_SetDevice($desc,$device);
}
static function TF_AddInput($desc,$input) {
TF_AddInput($desc,$input);
}
static function TF_AddInputList($desc,$inputs,$num_inputs) {
TF_AddInputList($desc,$inputs,$num_inputs);
}
static function TF_AddControlInput($desc,$input) {
TF_AddControlInput($desc,$input);
}
static function TF_ColocateWith($desc,$op) {
TF_ColocateWith($desc,$op);
}
static function TF_SetAttrString($desc,$attr_name,$value,$length) {
TF_SetAttrString($desc,$attr_name,$value,$length);
}
static function TF_SetAttrStringList($desc,$attr_name,$values,$lengths,$num_values) {
TF_SetAttrStringList($desc,$attr_name,$values,$lengths,$num_values);
}
static function TF_SetAttrInt($desc,$attr_name,$value) {
TF_SetAttrInt($desc,$attr_name,$value);
}
static function TF_SetAttrIntList($desc,$attr_name,$values,$num_values) {
TF_SetAttrIntList($desc,$attr_name,$values,$num_values);
}
static function TF_SetAttrFloat($desc,$attr_name,$value) {
TF_SetAttrFloat($desc,$attr_name,$value);
}
static function TF_SetAttrFloatList($desc,$attr_name,$values,$num_values) {
TF_SetAttrFloatList($desc,$attr_name,$values,$num_values);
}
static function TF_SetAttrBool($desc,$attr_name,$value) {
TF_SetAttrBool($desc,$attr_name,$value);
}
static function TF_SetAttrBoolList($desc,$attr_name,$values,$num_values) {
TF_SetAttrBoolList($desc,$attr_name,$values,$num_values);
}
static function TF_SetAttrType($desc,$attr_name,$value) {
TF_SetAttrType($desc,$attr_name,$value);
}
static function TF_SetAttrTypeList($desc,$attr_name,$values,$num_values) {
TF_SetAttrTypeList($desc,$attr_name,$values,$num_values);
}
static function TF_SetAttrShape($desc,$attr_name,$dims,$num_dims) {
TF_SetAttrShape($desc,$attr_name,$dims,$num_dims);
}
static function TF_SetAttrShapeList($desc,$attr_name,$dims,$num_dims,$num_shapes) {
TF_SetAttrShapeList($desc,$attr_name,$dims,$num_dims,$num_shapes);
}
static function TF_SetAttrTensorShapeProto($desc,$attr_name,$proto,$proto_len,$status) {
TF_SetAttrTensorShapeProto($desc,$attr_name,$proto,$proto_len,$status);
}
static function TF_SetAttrTensorShapeProtoList($desc,$attr_name,$protos,$proto_lens,$num_shapes,$status) {
TF_SetAttrTensorShapeProtoList($desc,$attr_name,$protos,$proto_lens,$num_shapes,$status);
}
static function TF_SetAttrTensor($desc,$attr_name,$value,$status) {
TF_SetAttrTensor($desc,$attr_name,$value,$status);
}
static function TF_SetAttrTensorList($desc,$attr_name,$values,$num_values,$status) {
TF_SetAttrTensorList($desc,$attr_name,$values,$num_values,$status);
}
static function TF_SetAttrValueProto($desc,$attr_name,$proto,$proto_len,$status) {
TF_SetAttrValueProto($desc,$attr_name,$proto,$proto_len,$status);
}
static function TF_FinishOperation($desc,$status) {
return TF_FinishOperation($desc,$status);
}
static function TF_OperationName($oper) {
return TF_OperationName($oper);
}
static function TF_OperationOpType($oper) {
return TF_OperationOpType($oper);
}
static function TF_OperationDevice($oper) {
return TF_OperationDevice($oper);
}
static function TF_OperationNumOutputs($oper) {
return TF_OperationNumOutputs($oper);
}
static function TF_OperationOutputType($oper_out) {
return TF_OperationOutputType($oper_out);
}
static function TF_OperationOutputListLength($oper,$arg_name,$status) {
return TF_OperationOutputListLength($oper,$arg_name,$status);
}
static function TF_OperationNumInputs($oper) {
return TF_OperationNumInputs($oper);
}
static function TF_OperationInputType($oper_in) {
return TF_OperationInputType($oper_in);
}
static function TF_OperationInputListLength($oper,$arg_name,$status) {
return TF_OperationInputListLength($oper,$arg_name,$status);
}
static function TF_OperationInput($oper_in) {
return TF_OperationInput($oper_in);
}
static function TF_OperationOutputNumConsumers($oper_out) {
return TF_OperationOutputNumConsumers($oper_out);
}
static function TF_OperationOutputConsumers($oper_out,$consumers,$max_consumers) {
return TF_OperationOutputConsumers($oper_out,$consumers,$max_consumers);
}
static function TF_OperationNumControlInputs($oper) {
return TF_OperationNumControlInputs($oper);
}
static function TF_OperationGetControlInputs($oper,$control_inputs,$max_control_inputs) {
return TF_OperationGetControlInputs($oper,$control_inputs,$max_control_inputs);
}
static function TF_OperationNumControlOutputs($oper) {
return TF_OperationNumControlOutputs($oper);
}
static function TF_OperationGetControlOutputs($oper,$control_outputs,$max_control_outputs) {
return TF_OperationGetControlOutputs($oper,$control_outputs,$max_control_outputs);
}
static function TF_OperationGetAttrMetadata($oper,$attr_name,$status) {
return TF_OperationGetAttrMetadata($oper,$attr_name,$status);
}
static function TF_OperationGetAttrString($oper,$attr_name,$value,$max_length,$status) {
TF_OperationGetAttrString($oper,$attr_name,$value,$max_length,$status);
}
static function TF_OperationGetAttrStringList($oper,$attr_name,$values,$lengths,$max_values,$storage,$storage_size,$status) {
TF_OperationGetAttrStringList($oper,$attr_name,$values,$lengths,$max_values,$storage,$storage_size,$status);
}
static function TF_OperationGetAttrInt($oper,$attr_name,$value,$status) {
TF_OperationGetAttrInt($oper,$attr_name,$value,$status);
}
static function TF_OperationGetAttrIntList($oper,$attr_name,$values,$max_values,$status) {
TF_OperationGetAttrIntList($oper,$attr_name,$values,$max_values,$status);
}
static function TF_OperationGetAttrFloat($oper,$attr_name,$value,$status) {
TF_OperationGetAttrFloat($oper,$attr_name,$value,$status);
}
static function TF_OperationGetAttrFloatList($oper,$attr_name,$values,$max_values,$status) {
TF_OperationGetAttrFloatList($oper,$attr_name,$values,$max_values,$status);
}
static function TF_OperationGetAttrBool($oper,$attr_name,$value,$status) {
TF_OperationGetAttrBool($oper,$attr_name,$value,$status);
}
static function TF_OperationGetAttrBoolList($oper,$attr_name,$values,$max_values,$status) {
TF_OperationGetAttrBoolList($oper,$attr_name,$values,$max_values,$status);
}
static function TF_OperationGetAttrType($oper,$attr_name,$value,$status) {
TF_OperationGetAttrType($oper,$attr_name,$value,$status);
}
static function TF_OperationGetAttrTypeList($oper,$attr_name,$values,$max_values,$status) {
TF_OperationGetAttrTypeList($oper,$attr_name,$values,$max_values,$status);
}
static function TF_OperationGetAttrShape($oper,$attr_name,$value,$num_dims,$status) {
TF_OperationGetAttrShape($oper,$attr_name,$value,$num_dims,$status);
}
static function TF_OperationGetAttrShapeList($oper,$attr_name,$dims,$num_dims,$num_shapes,$storage,$storage_size,$status) {
TF_OperationGetAttrShapeList($oper,$attr_name,$dims,$num_dims,$num_shapes,$storage,$storage_size,$status);
}
static function TF_OperationGetAttrTensorShapeProto($oper,$attr_name,$value,$status) {
TF_OperationGetAttrTensorShapeProto($oper,$attr_name,$value,$status);
}
static function TF_OperationGetAttrTensorShapeProtoList($oper,$attr_name,$values,$max_values,$status) {
TF_OperationGetAttrTensorShapeProtoList($oper,$attr_name,$values,$max_values,$status);
}
static function TF_OperationGetAttrTensor($oper,$attr_name,$value,$status) {
TF_OperationGetAttrTensor($oper,$attr_name,$value,$status);
}
static function TF_OperationGetAttrTensorList($oper,$attr_name,$values,$max_values,$status) {
TF_OperationGetAttrTensorList($oper,$attr_name,$values,$max_values,$status);
}
static function TF_OperationGetAttrValueProto($oper,$attr_name,$output_attr_value,$status) {
TF_OperationGetAttrValueProto($oper,$attr_name,$output_attr_value,$status);
}
static function TF_GraphOperationByName($graph,$oper_name) {
return TF_GraphOperationByName($graph,$oper_name);
}
static function TF_GraphNextOperation($graph,$pos) {
return TF_GraphNextOperation($graph,$pos);
}
static function TF_GraphToGraphDef($graph,$output_graph_def,$status) {
TF_GraphToGraphDef($graph,$output_graph_def,$status);
}
static function TF_NewImportGraphDefOptions() {
return TF_NewImportGraphDefOptions();
}
static function TF_DeleteImportGraphDefOptions($opts) {
TF_DeleteImportGraphDefOptions($opts);
}
static function TF_ImportGraphDefOptionsSetPrefix($opts,$prefix) {
TF_ImportGraphDefOptionsSetPrefix($opts,$prefix);
}
static function TF_ImportGraphDefOptionsAddInputMapping($opts,$src_name,$src_index,$dst) {
TF_ImportGraphDefOptionsAddInputMapping($opts,$src_name,$src_index,$dst);
}
static function TF_ImportGraphDefOptionsAddControlDependency($opts,$oper) {
TF_ImportGraphDefOptionsAddControlDependency($opts,$oper);
}
static function TF_ImportGraphDefOptionsAddReturnOutput($opts,$oper_name,$index) {
TF_ImportGraphDefOptionsAddReturnOutput($opts,$oper_name,$index);
}
static function TF_ImportGraphDefOptionsNumReturnOutputs($opts) {
return TF_ImportGraphDefOptionsNumReturnOutputs($opts);
}
static function TF_GraphImportGraphDefWithReturnOutputs($graph,$graph_def,$options,$return_outputs,$num_return_outputs,$status) {
TF_GraphImportGraphDefWithReturnOutputs($graph,$graph_def,$options,$return_outputs,$num_return_outputs,$status);
}
static function TF_GraphImportGraphDef($graph,$graph_def,$options,$status) {
TF_GraphImportGraphDef($graph,$graph_def,$options,$status);
}
static function TF_OperationToNodeDef($oper,$output_node_def,$status) {
TF_OperationToNodeDef($oper,$output_node_def,$status);
}
static function TF_NewSession($graph,$opts,$status) {
return TF_NewSession($graph,$opts,$status);
}
static function TF_LoadSessionFromSavedModel($session_options,$run_options,$export_dir,$tags,$tags_len,$graph,$meta_graph_def,$status) {
return TF_LoadSessionFromSavedModel($session_options,$run_options,$export_dir,$tags,$tags_len,$graph,$meta_graph_def,$status);
}
static function TF_CloseSession($arg1,$status) {
TF_CloseSession($arg1,$status);
}
static function TF_DeleteSession($arg1,$status) {
TF_DeleteSession($arg1,$status);
}
static function TF_SessionRun($session,$run_options,$inputs,$input_values,$ninputs,$outputs,$output_values,$noutputs,$target_opers,$ntargets,$run_metadata,$arg12) {
TF_SessionRun($session,$run_options,$inputs,$input_values,$ninputs,$outputs,$output_values,$noutputs,$target_opers,$ntargets,$run_metadata,$arg12);
}
static function TF_SessionPRunSetup($arg1,$inputs,$ninputs,$outputs,$noutputs,$target_opers,$ntargets,$handle,$arg9) {
TF_SessionPRunSetup($arg1,$inputs,$ninputs,$outputs,$noutputs,$target_opers,$ntargets,$handle,$arg9);
}
static function TF_SessionPRun($arg1,$handle,$inputs,$input_values,$ninputs,$outputs,$output_values,$noutputs,$target_opers,$ntargets,$arg11) {
TF_SessionPRun($arg1,$handle,$inputs,$input_values,$ninputs,$outputs,$output_values,$noutputs,$target_opers,$ntargets,$arg11);
}
static function TF_NewDeprecatedSession($arg1,$status) {
return TF_NewDeprecatedSession($arg1,$status);
}
static function TF_CloseDeprecatedSession($arg1,$status) {
TF_CloseDeprecatedSession($arg1,$status);
}
static function TF_DeleteDeprecatedSession($arg1,$status) {
TF_DeleteDeprecatedSession($arg1,$status);
}
static function TF_Reset($opt,$containers,$ncontainers,$status) {
TF_Reset($opt,$containers,$ncontainers,$status);
}
static function TF_ExtendGraph($arg1,$proto,$proto_len,$arg4) {
TF_ExtendGraph($arg1,$proto,$proto_len,$arg4);
}
static function TF_Run($arg1,$run_options,$input_names,$inputs,$ninputs,$output_names,$outputs,$noutputs,$target_oper_names,$ntargets,$run_metadata,$arg12) {
TF_Run($arg1,$run_options,$input_names,$inputs,$ninputs,$output_names,$outputs,$noutputs,$target_oper_names,$ntargets,$run_metadata,$arg12);
}
static function TF_PRunSetup($arg1,$input_names,$ninputs,$output_names,$noutputs,$target_oper_names,$ntargets,$handle,$arg9) {
TF_PRunSetup($arg1,$input_names,$ninputs,$output_names,$noutputs,$target_oper_names,$ntargets,$handle,$arg9);
}
static function TF_PRun($arg1,$handle,$input_names,$inputs,$ninputs,$output_names,$outputs,$noutputs,$target_oper_names,$ntargets,$arg11) {
TF_PRun($arg1,$handle,$input_names,$inputs,$ninputs,$output_names,$outputs,$noutputs,$target_oper_names,$ntargets,$arg11);
}
static function TF_LoadLibrary($library_filename,$status) {
return TF_LoadLibrary($library_filename,$status);
}
static function TF_GetOpList($lib_handle) {
return TF_GetOpList($lib_handle);
}
static function TF_DeleteLibraryHandle($lib_handle) {
TF_DeleteLibraryHandle($lib_handle);
}
static function TF_GetAllOpList() {
return TF_GetAllOpList();
}
const PHP_TF_FLOAT = PHP_TF_FLOAT;
const PHP_TF_DOUBLE = PHP_TF_DOUBLE;
const PHP_TF_INT32 = PHP_TF_INT32;
const PHP_TF_UINT8 = PHP_TF_UINT8;
const PHP_TF_INT16 = PHP_TF_INT16;
const PHP_TF_INT8 = PHP_TF_INT8;
const PHP_TF_STRING = PHP_TF_STRING;
const PHP_TF_COMPLEX64 = PHP_TF_COMPLEX64;
const PHP_TF_COMPLEX = PHP_TF_COMPLEX;
const PHP_TF_INT64 = PHP_TF_INT64;
const PHP_TF_BOOL = PHP_TF_BOOL;
const PHP_TF_QINT8 = PHP_TF_QINT8;
const PHP_TF_QUINT8 = PHP_TF_QUINT8;
const PHP_TF_QINT32 = PHP_TF_QINT32;
const PHP_TF_BFLOAT16 = PHP_TF_BFLOAT16;
const PHP_TF_QINT16 = PHP_TF_QINT16;
const PHP_TF_QUINT16 = PHP_TF_QUINT16;
const PHP_TF_UINT16 = PHP_TF_UINT16;
const PHP_TF_COMPLEX128 = PHP_TF_COMPLEX128;
const PHP_TF_HALF = PHP_TF_HALF;
const PHP_TF_RESOURCE = PHP_TF_RESOURCE;
const PHP_TF_OK = PHP_TF_OK;
const PHP_TF_CANCELLED = PHP_TF_CANCELLED;
const PHP_TF_UNKNOWN = PHP_TF_UNKNOWN;
const PHP_TF_INVALID_ARGUMENT = PHP_TF_INVALID_ARGUMENT;
const PHP_TF_DEADLINE_EXCEEDED = PHP_TF_DEADLINE_EXCEEDED;
const PHP_TF_NOT_FOUND = PHP_TF_NOT_FOUND;
const PHP_TF_ALREADY_EXISTS = PHP_TF_ALREADY_EXISTS;
const PHP_TF_PERMISSION_DENIED = PHP_TF_PERMISSION_DENIED;
const PHP_TF_UNAUTHENTICATED = PHP_TF_UNAUTHENTICATED;
const PHP_TF_RESOURCE_EXHAUSTED = PHP_TF_RESOURCE_EXHAUSTED;
const PHP_TF_FAILED_PRECONDITION = PHP_TF_FAILED_PRECONDITION;
const PHP_TF_ABORTED = PHP_TF_ABORTED;
const PHP_TF_OUT_OF_RANGE = PHP_TF_OUT_OF_RANGE;
const PHP_TF_UNIMPLEMENTED = PHP_TF_UNIMPLEMENTED;
const PHP_TF_INTERNAL = PHP_TF_INTERNAL;
const PHP_TF_UNAVAILABLE = PHP_TF_UNAVAILABLE;
const PHP_TF_DATA_LOSS = PHP_TF_DATA_LOSS;
}
/* PHP Proxy Classes */
?>