FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TensorFlow.NET/src/TensorFlowNET.Core/Protobuf/Function.cs at master · wadereye/TensorFlow.NET · GitHub
wadereye
/
TensorFlow.NET
Public
forked from
SciSharp/TensorFlow.NET
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Core
/
Protobuf
/
Function.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
604 lines (541 loc) · 22.4 KB
Breadcrumbs
TensorFlow.NET
/
src
/
TensorFlowNET.Core
/
Protobuf
/
Function.cs
Copy path
File metadata and controls
604 lines (541 loc) · 22.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: function.proto
// </auto-generated>
#pragma warning disable
1591
,
0612
,
3021
#region Designer generated code
using
pb
=
global
::
Google
.
Protobuf
;
using
pbc
=
global
::
Google
.
Protobuf
.
Collections
;
using
pbr
=
global
::
Google
.
Protobuf
.
Reflection
;
using
scg
=
global
::
System
.
Collections
.
Generic
;
namespace
Tensorflow
{
/// <summary>Holder for reflection information generated from function.proto</summary>
public
static
partial
class
FunctionReflection
{
#region Descriptor
/// <summary>File descriptor for function.proto</summary>
public
static
pbr
::
FileDescriptor
Descriptor
{
get
{
return
descriptor
;
}
}
private
static
pbr
::
FileDescriptor
descriptor
;
static
FunctionReflection
(
)
{
byte
[
]
descriptorData
=
global
::
System
.
Convert
.
FromBase64String
(
string
.
Concat
(
"Cg5mdW5jdGlvbi5wcm90bxIKdGVuc29yZmxvdxoQYXR0cl92YWx1ZS5wcm90"
,
"bxoObm9kZV9kZWYucHJvdG8aDG9wX2RlZi5wcm90byJqChJGdW5jdGlvbkRl"
,
"ZkxpYnJhcnkSKQoIZnVuY3Rpb24YASADKAsyFy50ZW5zb3JmbG93LkZ1bmN0"
,
"aW9uRGVmEikKCGdyYWRpZW50GAIgAygLMhcudGVuc29yZmxvdy5HcmFkaWVu"
,
"dERlZiKwAgoLRnVuY3Rpb25EZWYSJAoJc2lnbmF0dXJlGAEgASgLMhEudGVu"
,
"c29yZmxvdy5PcERlZhIvCgRhdHRyGAUgAygLMiEudGVuc29yZmxvdy5GdW5j"
,
"dGlvbkRlZi5BdHRyRW50cnkSJQoIbm9kZV9kZWYYAyADKAsyEy50ZW5zb3Jm"
,
"bG93Lk5vZGVEZWYSLQoDcmV0GAQgAygLMiAudGVuc29yZmxvdy5GdW5jdGlv"
,
"bkRlZi5SZXRFbnRyeRpCCglBdHRyRW50cnkSCwoDa2V5GAEgASgJEiQKBXZh"
,
"bHVlGAIgASgLMhUudGVuc29yZmxvdy5BdHRyVmFsdWU6AjgBGioKCFJldEVu"
,
"dHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToCOAFKBAgCEAMiOwoL"
,
"R3JhZGllbnREZWYSFQoNZnVuY3Rpb25fbmFtZRgBIAEoCRIVCg1ncmFkaWVu"
,
"dF9mdW5jGAIgASgJQm4KGG9yZy50ZW5zb3JmbG93LmZyYW1ld29ya0IORnVu"
,
"Y3Rpb25Qcm90b3NQAVo9Z2l0aHViLmNvbS90ZW5zb3JmbG93L3RlbnNvcmZs"
,
"b3cvdGVuc29yZmxvdy9nby9jb3JlL2ZyYW1ld29ya/gBAWIGcHJvdG8z"
)
)
;
descriptor
=
pbr
::
FileDescriptor
.
FromGeneratedCode
(
descriptorData
,
new
pbr
::
FileDescriptor
[
]
{
global
::
Tensorflow
.
AttrValueReflection
.
Descriptor
,
global
::
Tensorflow
.
NodeDefReflection
.
Descriptor
,
global
::
Tensorflow
.
OpDefReflection
.
Descriptor
,
}
,
new
pbr
::
GeneratedClrTypeInfo
(
null
,
new
pbr
::
GeneratedClrTypeInfo
[
]
{
new
pbr
::
GeneratedClrTypeInfo
(
typeof
(
global
::
Tensorflow
.
FunctionDefLibrary
)
,
global
::
Tensorflow
.
FunctionDefLibrary
.
Parser
,
new
[
]
{
"Function"
,
"Gradient"
}
,
null
,
null
,
null
)
,
new
pbr
::
GeneratedClrTypeInfo
(
typeof
(
global
::
Tensorflow
.
FunctionDef
)
,
global
::
Tensorflow
.
FunctionDef
.
Parser
,
new
[
]
{
"Signature"
,
"Attr"
,
"NodeDef"
,
"Ret"
}
,
null
,
null
,
new
pbr
::
GeneratedClrTypeInfo
[
]
{
null
,
null
,
}
)
,
new
pbr
::
GeneratedClrTypeInfo
(
typeof
(
global
::
Tensorflow
.
GradientDef
)
,
global
::
Tensorflow
.
GradientDef
.
Parser
,
new
[
]
{
"FunctionName"
,
"GradientFunc"
}
,
null
,
null
,
null
)
}
)
)
;
}
#endregion
}
#region Messages
/// <summary>
/// A library is a set of named functions.
/// </summary>
public
sealed
partial
class
FunctionDefLibrary
:
pb
::
IMessage
<
FunctionDefLibrary
>
{
private
static
readonly
pb
::
MessageParser
<
FunctionDefLibrary
>
_parser
=
new
pb
::
MessageParser
<
FunctionDefLibrary
>
(
(
)
=>
new
FunctionDefLibrary
(
)
)
;
private
pb
::
UnknownFieldSet
_unknownFields
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
static
pb
::
MessageParser
<
FunctionDefLibrary
>
Parser
{
get
{
return
_parser
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
static
pbr
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Tensorflow
.
FunctionReflection
.
Descriptor
.
MessageTypes
[
0
]
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
pbr
::
MessageDescriptor
pb
::
IMessage
.
Descriptor
{
get
{
return
Descriptor
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
FunctionDefLibrary
(
)
{
OnConstruction
(
)
;
}
partial
void
OnConstruction
(
)
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
FunctionDefLibrary
(
FunctionDefLibrary
other
)
:
this
(
)
{
function_
=
other
.
function_
.
Clone
(
)
;
gradient_
=
other
.
gradient_
.
Clone
(
)
;
_unknownFields
=
pb
::
UnknownFieldSet
.
Clone
(
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
FunctionDefLibrary
Clone
(
)
{
return
new
FunctionDefLibrary
(
this
)
;
}
/// <summary>Field number for the "function" field.</summary>
public
const
int
FunctionFieldNumber
=
1
;
private
static
readonly
pb
::
FieldCodec
<
global
::
Tensorflow
.
FunctionDef
>
_repeated_function_codec
=
pb
::
FieldCodec
.
ForMessage
(
10
,
global
::
Tensorflow
.
FunctionDef
.
Parser
)
;
private
readonly
pbc
::
RepeatedField
<
global
::
Tensorflow
.
FunctionDef
>
function_
=
new
pbc
::
RepeatedField
<
global
::
Tensorflow
.
FunctionDef
>
(
)
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
pbc
::
RepeatedField
<
global
::
Tensorflow
.
FunctionDef
>
Function
{
get
{
return
function_
;
}
}
/// <summary>Field number for the "gradient" field.</summary>
public
const
int
GradientFieldNumber
=
2
;
private
static
readonly
pb
::
FieldCodec
<
global
::
Tensorflow
.
GradientDef
>
_repeated_gradient_codec
=
pb
::
FieldCodec
.
ForMessage
(
18
,
global
::
Tensorflow
.
GradientDef
.
Parser
)
;
private
readonly
pbc
::
RepeatedField
<
global
::
Tensorflow
.
GradientDef
>
gradient_
=
new
pbc
::
RepeatedField
<
global
::
Tensorflow
.
GradientDef
>
(
)
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
pbc
::
RepeatedField
<
global
::
Tensorflow
.
GradientDef
>
Gradient
{
get
{
return
gradient_
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
bool
Equals
(
object
other
)
{
return
Equals
(
other
as
FunctionDefLibrary
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
bool
Equals
(
FunctionDefLibrary
other
)
{
if
(
ReferenceEquals
(
other
,
null
)
)
{
return
false
;
}
if
(
ReferenceEquals
(
other
,
this
)
)
{
return
true
;
}
if
(
!
function_
.
Equals
(
other
.
function_
)
)
return
false
;
if
(
!
gradient_
.
Equals
(
other
.
gradient_
)
)
return
false
;
return
Equals
(
_unknownFields
,
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
int
GetHashCode
(
)
{
int
hash
=
1
;
hash
^=
function_
.
GetHashCode
(
)
;
hash
^=
gradient_
.
GetHashCode
(
)
;
if
(
_unknownFields
!=
null
)
{
hash
^=
_unknownFields
.
GetHashCode
(
)
;
}
return
hash
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
string
ToString
(
)
{
return
pb
::
JsonFormatter
.
ToDiagnosticString
(
this
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
WriteTo
(
pb
::
CodedOutputStream
output
)
{
function_
.
WriteTo
(
output
,
_repeated_function_codec
)
;
gradient_
.
WriteTo
(
output
,
_repeated_gradient_codec
)
;
if
(
_unknownFields
!=
null
)
{
_unknownFields
.
WriteTo
(
output
)
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
int
CalculateSize
(
)
{
int
size
=
0
;
size
+=
function_
.
CalculateSize
(
_repeated_function_codec
)
;
size
+=
gradient_
.
CalculateSize
(
_repeated_gradient_codec
)
;
if
(
_unknownFields
!=
null
)
{
size
+=
_unknownFields
.
CalculateSize
(
)
;
}
return
size
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
MergeFrom
(
FunctionDefLibrary
other
)
{
if
(
other
==
null
)
{
return
;
}
function_
.
Add
(
other
.
function_
)
;
gradient_
.
Add
(
other
.
gradient_
)
;
_unknownFields
=
pb
::
UnknownFieldSet
.
MergeFrom
(
_unknownFields
,
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
MergeFrom
(
pb
::
CodedInputStream
input
)
{
uint
tag
;
while
(
(
tag
=
input
.
ReadTag
(
)
)
!=
0
)
{
switch
(
tag
)
{
default
:
_unknownFields
=
pb
::
UnknownFieldSet
.
MergeFieldFrom
(
_unknownFields
,
input
)
;
break
;
case
10
:
{
function_
.
AddEntriesFrom
(
input
,
_repeated_function_codec
)
;
break
;
}
case
18
:
{
gradient_
.
AddEntriesFrom
(
input
,
_repeated_gradient_codec
)
;
break
;
}
}
}
}
}
/// <summary>
/// A function can be instantiated when the runtime can bind every attr
/// with a value. When a GraphDef has a call to a function, it must
/// have binding for every attr defined in the signature.
///
/// TODO(zhifengc):
/// * device spec, etc.
/// </summary>
public
sealed
partial
class
FunctionDef
:
pb
::
IMessage
<
FunctionDef
>
{
private
static
readonly
pb
::
MessageParser
<
FunctionDef
>
_parser
=
new
pb
::
MessageParser
<
FunctionDef
>
(
(
)
=>
new
FunctionDef
(
)
)
;
private
pb
::
UnknownFieldSet
_unknownFields
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
static
pb
::
MessageParser
<
FunctionDef
>
Parser
{
get
{
return
_parser
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
static
pbr
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Tensorflow
.
FunctionReflection
.
Descriptor
.
MessageTypes
[
1
]
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
pbr
::
MessageDescriptor
pb
::
IMessage
.
Descriptor
{
get
{
return
Descriptor
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
FunctionDef
(
)
{
OnConstruction
(
)
;
}
partial
void
OnConstruction
(
)
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
FunctionDef
(
FunctionDef
other
)
:
this
(
)
{
signature_
=
other
.
signature_
!=
null
?
other
.
signature_
.
Clone
(
)
:
null
;
attr_
=
other
.
attr_
.
Clone
(
)
;
nodeDef_
=
other
.
nodeDef_
.
Clone
(
)
;
ret_
=
other
.
ret_
.
Clone
(
)
;
_unknownFields
=
pb
::
UnknownFieldSet
.
Clone
(
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
FunctionDef
Clone
(
)
{
return
new
FunctionDef
(
this
)
;
}
/// <summary>Field number for the "signature" field.</summary>
public
const
int
SignatureFieldNumber
=
1
;
private
global
::
Tensorflow
.
OpDef
signature_
;
/// <summary>
/// The definition of the function's name, arguments, return values,
/// attrs etc.
/// </summary>
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
global
::
Tensorflow
.
OpDef
Signature
{
get
{
return
signature_
;
}
set
{
signature_
=
value
;
}
}
/// <summary>Field number for the "attr" field.</summary>
public
const
int
AttrFieldNumber
=
5
;
private
static
readonly
pbc
::
MapField
<
string
,
global
::
Tensorflow
.
AttrValue
>
.
Codec
_map_attr_codec
=
new
pbc
::
MapField
<
string
,
global
::
Tensorflow
.
AttrValue
>
.
Codec
(
pb
::
FieldCodec
.
ForString
(
10
)
,
pb
::
FieldCodec
.
ForMessage
(
18
,
global
::
Tensorflow
.
AttrValue
.
Parser
)
,
42
)
;
private
readonly
pbc
::
MapField
<
string
,
global
::
Tensorflow
.
AttrValue
>
attr_
=
new
pbc
::
MapField
<
string
,
global
::
Tensorflow
.
AttrValue
>
(
)
;
/// <summary>
/// Attributes specific to this function definition.
/// </summary>
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
pbc
::
MapField
<
string
,
global
::
Tensorflow
.
AttrValue
>
Attr
{
get
{
return
attr_
;
}
}
/// <summary>Field number for the "node_def" field.</summary>
public
const
int
NodeDefFieldNumber
=
3
;
private
static
readonly
pb
::
FieldCodec
<
global
::
Tensorflow
.
NodeDef
>
_repeated_nodeDef_codec
=
pb
::
FieldCodec
.
ForMessage
(
26
,
global
::
Tensorflow
.
NodeDef
.
Parser
)
;
private
readonly
pbc
::
RepeatedField
<
global
::
Tensorflow
.
NodeDef
>
nodeDef_
=
new
pbc
::
RepeatedField
<
global
::
Tensorflow
.
NodeDef
>
(
)
;
/// <summary>
/// By convention, "op" in node_def is resolved by consulting with a
/// user-defined library first. If not resolved, "func" is assumed to
/// be a builtin op.
/// </summary>
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
pbc
::
RepeatedField
<
global
::
Tensorflow
.
NodeDef
>
NodeDef
{
get
{
return
nodeDef_
;
}
}
/// <summary>Field number for the "ret" field.</summary>
public
const
int
RetFieldNumber
=
4
;
private
static
readonly
pbc
::
MapField
<
string
,
string
>
.
Codec
_map_ret_codec
=
new
pbc
::
MapField
<
string
,
string
>
.
Codec
(
pb
::
FieldCodec
.
ForString
(
10
)
,
pb
::
FieldCodec
.
ForString
(
18
)
,
34
)
;
private
readonly
pbc
::
MapField
<
string
,
string
>
ret_
=
new
pbc
::
MapField
<
string
,
string
>
(
)
;
/// <summary>
/// A mapping from the output arg names from `signature` to the
/// outputs from `node_def` that should be returned by the function.
/// </summary>
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
pbc
::
MapField
<
string
,
string
>
Ret
{
get
{
return
ret_
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
bool
Equals
(
object
other
)
{
return
Equals
(
other
as
FunctionDef
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
bool
Equals
(
FunctionDef
other
)
{
if
(
ReferenceEquals
(
other
,
null
)
)
{
return
false
;
}
if
(
ReferenceEquals
(
other
,
this
)
)
{
return
true
;
}
if
(
!
object
.
Equals
(
Signature
,
other
.
Signature
)
)
return
false
;
if
(
!
Attr
.
Equals
(
other
.
Attr
)
)
return
false
;
if
(
!
nodeDef_
.
Equals
(
other
.
nodeDef_
)
)
return
false
;
if
(
!
Ret
.
Equals
(
other
.
Ret
)
)
return
false
;
return
Equals
(
_unknownFields
,
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
int
GetHashCode
(
)
{
int
hash
=
1
;
if
(
signature_
!=
null
)
hash
^=
Signature
.
GetHashCode
(
)
;
hash
^=
Attr
.
GetHashCode
(
)
;
hash
^=
nodeDef_
.
GetHashCode
(
)
;
hash
^=
Ret
.
GetHashCode
(
)
;
if
(
_unknownFields
!=
null
)
{
hash
^=
_unknownFields
.
GetHashCode
(
)
;
}
return
hash
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
string
ToString
(
)
{
return
pb
::
JsonFormatter
.
ToDiagnosticString
(
this
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
WriteTo
(
pb
::
CodedOutputStream
output
)
{
if
(
signature_
!=
null
)
{
output
.
WriteRawTag
(
10
)
;
output
.
WriteMessage
(
Signature
)
;
}
nodeDef_
.
WriteTo
(
output
,
_repeated_nodeDef_codec
)
;
ret_
.
WriteTo
(
output
,
_map_ret_codec
)
;
attr_
.
WriteTo
(
output
,
_map_attr_codec
)
;
if
(
_unknownFields
!=
null
)
{
_unknownFields
.
WriteTo
(
output
)
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
int
CalculateSize
(
)
{
int
size
=
0
;
if
(
signature_
!=
null
)
{
size
+=
1
+
pb
::
CodedOutputStream
.
ComputeMessageSize
(
Signature
)
;
}
size
+=
attr_
.
CalculateSize
(
_map_attr_codec
)
;
size
+=
nodeDef_
.
CalculateSize
(
_repeated_nodeDef_codec
)
;
size
+=
ret_
.
CalculateSize
(
_map_ret_codec
)
;
if
(
_unknownFields
!=
null
)
{
size
+=
_unknownFields
.
CalculateSize
(
)
;
}
return
size
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
MergeFrom
(
FunctionDef
other
)
{
if
(
other
==
null
)
{
return
;
}
if
(
other
.
signature_
!=
null
)
{
if
(
signature_
==
null
)
{
signature_
=
new
global
::
Tensorflow
.
OpDef
(
)
;
}
Signature
.
MergeFrom
(
other
.
Signature
)
;
}
attr_
.
Add
(
other
.
attr_
)
;
nodeDef_
.
Add
(
other
.
nodeDef_
)
;
ret_
.
Add
(
other
.
ret_
)
;
_unknownFields
=
pb
::
UnknownFieldSet
.
MergeFrom
(
_unknownFields
,
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
MergeFrom
(
pb
::
CodedInputStream
input
)
{
uint
tag
;
while
(
(
tag
=
input
.
ReadTag
(
)
)
!=
0
)
{
switch
(
tag
)
{
default
:
_unknownFields
=
pb
::
UnknownFieldSet
.
MergeFieldFrom
(
_unknownFields
,
input
)
;
break
;
case
10
:
{
if
(
signature_
==
null
)
{
signature_
=
new
global
::
Tensorflow
.
OpDef
(
)
;
}
input
.
ReadMessage
(
signature_
)
;
break
;
}
case
26
:
{
nodeDef_
.
AddEntriesFrom
(
input
,
_repeated_nodeDef_codec
)
;
break
;
}
case
34
:
{
ret_
.
AddEntriesFrom
(
input
,
_map_ret_codec
)
;
break
;
}
case
42
:
{
attr_
.
AddEntriesFrom
(
input
,
_map_attr_codec
)
;
break
;
}
}
}
}
}
/// <summary>
/// GradientDef defines the gradient function of a function defined in
/// a function library.
///
/// A gradient function g (specified by gradient_func) for a function f
/// (specified by function_name) must follow the following:
///
/// The function 'f' must be a numerical function which takes N inputs
/// and produces M outputs. Its gradient function 'g', which is a
/// function taking N + M inputs and produces N outputs.
///
/// I.e. if we have
/// (y1, y2, ..., y_M) = f(x1, x2, ..., x_N),
/// then, g is
/// (dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N,
/// dL/dy1, dL/dy2, ..., dL/dy_M),
/// where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the
/// loss function). dL/dx_i is the partial derivative of L with respect
/// to x_i.
/// </summary>
public
sealed
partial
class
GradientDef
:
pb
::
IMessage
<
GradientDef
>
{
private
static
readonly
pb
::
MessageParser
<
GradientDef
>
_parser
=
new
pb
::
MessageParser
<
GradientDef
>
(
(
)
=>
new
GradientDef
(
)
)
;
private
pb
::
UnknownFieldSet
_unknownFields
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
static
pb
::
MessageParser
<
GradientDef
>
Parser
{
get
{
return
_parser
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
static
pbr
::
MessageDescriptor
Descriptor
{
get
{
return
global
::
Tensorflow
.
FunctionReflection
.
Descriptor
.
MessageTypes
[
2
]
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
pbr
::
MessageDescriptor
pb
::
IMessage
.
Descriptor
{
get
{
return
Descriptor
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
GradientDef
(
)
{
OnConstruction
(
)
;
}
partial
void
OnConstruction
(
)
;
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
GradientDef
(
GradientDef
other
)
:
this
(
)
{
functionName_
=
other
.
functionName_
;
gradientFunc_
=
other
.
gradientFunc_
;
_unknownFields
=
pb
::
UnknownFieldSet
.
Clone
(
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
GradientDef
Clone
(
)
{
return
new
GradientDef
(
this
)
;
}
/// <summary>Field number for the "function_name" field.</summary>
public
const
int
FunctionNameFieldNumber
=
1
;
private
string
functionName_
=
""
;
/// <summary>
/// The function name.
/// </summary>
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
string
FunctionName
{
get
{
return
functionName_
;
}
set
{
functionName_
=
pb
::
ProtoPreconditions
.
CheckNotNull
(
value
,
"value"
)
;
}
}
/// <summary>Field number for the "gradient_func" field.</summary>
public
const
int
GradientFuncFieldNumber
=
2
;
private
string
gradientFunc_
=
""
;
/// <summary>
/// The gradient function's name.
/// </summary>
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
string
GradientFunc
{
get
{
return
gradientFunc_
;
}
set
{
gradientFunc_
=
pb
::
ProtoPreconditions
.
CheckNotNull
(
value
,
"value"
)
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
bool
Equals
(
object
other
)
{
return
Equals
(
other
as
GradientDef
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
bool
Equals
(
GradientDef
other
)
{
if
(
ReferenceEquals
(
other
,
null
)
)
{
return
false
;
}
if
(
ReferenceEquals
(
other
,
this
)
)
{
return
true
;
}
if
(
FunctionName
!=
other
.
FunctionName
)
return
false
;
if
(
GradientFunc
!=
other
.
GradientFunc
)
return
false
;
return
Equals
(
_unknownFields
,
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
int
GetHashCode
(
)
{
int
hash
=
1
;
if
(
FunctionName
.
Length
!=
0
)
hash
^=
FunctionName
.
GetHashCode
(
)
;
if
(
GradientFunc
.
Length
!=
0
)
hash
^=
GradientFunc
.
GetHashCode
(
)
;
if
(
_unknownFields
!=
null
)
{
hash
^=
_unknownFields
.
GetHashCode
(
)
;
}
return
hash
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
override
string
ToString
(
)
{
return
pb
::
JsonFormatter
.
ToDiagnosticString
(
this
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
WriteTo
(
pb
::
CodedOutputStream
output
)
{
if
(
FunctionName
.
Length
!=
0
)
{
output
.
WriteRawTag
(
10
)
;
output
.
WriteString
(
FunctionName
)
;
}
if
(
GradientFunc
.
Length
!=
0
)
{
output
.
WriteRawTag
(
18
)
;
output
.
WriteString
(
GradientFunc
)
;
}
if
(
_unknownFields
!=
null
)
{
_unknownFields
.
WriteTo
(
output
)
;
}
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
int
CalculateSize
(
)
{
int
size
=
0
;
if
(
FunctionName
.
Length
!=
0
)
{
size
+=
1
+
pb
::
CodedOutputStream
.
ComputeStringSize
(
FunctionName
)
;
}
if
(
GradientFunc
.
Length
!=
0
)
{
size
+=
1
+
pb
::
CodedOutputStream
.
ComputeStringSize
(
GradientFunc
)
;
}
if
(
_unknownFields
!=
null
)
{
size
+=
_unknownFields
.
CalculateSize
(
)
;
}
return
size
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
MergeFrom
(
GradientDef
other
)
{
if
(
other
==
null
)
{
return
;
}
if
(
other
.
FunctionName
.
Length
!=
0
)
{
FunctionName
=
other
.
FunctionName
;
}
if
(
other
.
GradientFunc
.
Length
!=
0
)
{
GradientFunc
=
other
.
GradientFunc
;
}
_unknownFields
=
pb
::
UnknownFieldSet
.
MergeFrom
(
_unknownFields
,
other
.
_unknownFields
)
;
}
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
]
public
void
MergeFrom
(
pb
::
CodedInputStream
input
)
{
uint
tag
;
while
(
(
tag
=
input
.
ReadTag
(
)
)
!=
0
)
{
switch
(
tag
)
{
default
:
_unknownFields
=
pb
::
UnknownFieldSet
.
MergeFieldFrom
(
_unknownFields
,
input
)
;
break
;
case
10
:
{
FunctionName
=
input
.
ReadString
(
)
;
break
;
}
case
18
:
{
GradientFunc
=
input
.
ReadString
(
)
;
break
;
}
}
}
}
}
#endregion
}
#endregion Designer generated code
Back
|
FazBrowse Home
|
New Git URL