1/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16// Inputs/Outputs exclusion lists for GradientTape.
17//
18// This file is MACHINE GENERATED! Do not edit.
19// Generated by: tensorflow/python/eager/gen_gradient_input_output_exclusions.py
20
21#include "tensorflow/python/eager/pywrap_gradient_exclusions.h"
22
23#include "absl/types/optional.h"
24#include "tensorflow/core/lib/gtl/flatmap.h"
25#include "tensorflow/core/lib/gtl/flatset.h"
26
27using tensorflow::string;
28
29namespace {
30// Keep static data in a format that's easy to init statically.
31struct OpIndexInfo {
32 const char *op_name;
33 int num_indices;
34 std::array<int, 4> unused_indices;
35};
36
37// Helper function to initialize FlatMap<string,FlatSet> from OpIndexInfo.
38template <typename T>
39auto OpGradientInfoInit(const T &a) {
40 auto *m = new tensorflow::gtl::FlatMap<string, tensorflow::gtl::FlatSet<int>>;
41 for (const auto &item : a) {
42 m->emplace(string(item.op_name),
43 tensorflow::gtl::FlatSet<int>(
44 item.unused_indices.begin(),
45 item.unused_indices.begin() + item.num_indices));
46 }
47 return m;
48}
49} // namespace
50
51absl::optional<tensorflow::gtl::FlatSet<int>> OpGradientUnusedInputIndices(
52 const tensorflow::string &op_name) {
53 static std::array<OpIndexInfo, 364> a = {{
54 {"Acosh"},
55 {"AllToAll", 1, {0}},
56 {"ApproximateEqual"},
57 {"ArgMax"},
58 {"ArgMin"},
59 {"AsString"},
60 {"Asinh"},
61 {"Assign"},
62 {"AssignAdd"},
63 {"AssignSub"},
64 {"AudioSummary"},
65 {"AudioSummaryV2"},
66 {"AvgPool3DGrad", 1, {1}},
67 {"AvgPoolGrad", 1, {1}},
68 {"BatchNormWithGlobalNormalization", 1, {3}},
69 {"BatchToSpace", 1, {0}},
70 {"BatchToSpaceND", 1, {0}},
71 {"BiasAdd"},
72 {"BiasAddV1"},
73 {"BitwiseAnd"},
74 {"BitwiseOr"},
75 {"BitwiseXor"},
76 {"BroadcastGradientArgs"},
77 {"CSRSparseMatrixToSparseTensor"},
78 {"CTCBeamSearchDecoder"},
79 {"CTCGreedyDecoder"},
80 {"CTCLoss"},
81 {"CTCLossV2"},
82 {"Ceil"},
83 {"CheckNumerics"},
84 {"CheckNumericsV2"},
85 {"Cholesky"},
86 {"CollectivePermute", 1, {0}},
87 {"CompositeTensorVariantFromComponents"},
88 {"CompositeTensorVariantToComponents"},
89 {"Conj"},
90 {"ConjugateTranspose", 1, {0}},
91 {"Const"},
92 {"Conv2DBackpropFilter", 1, {1}},
93 {"Conv2DBackpropInput", 1, {0}},
94 {"Conv3DBackpropFilterV2", 1, {1}},
95 {"Conv3DBackpropInputV2", 1, {0}},
96 {"CropAndResize", 1, {3}},
97 {"CrossReplicaSum", 1, {0}},
98 {"Cumsum", 1, {0}},
99 {"DebugGradientIdentity"},
100 {"DebugGradientRefIdentity"},
101 {"DebugIdentityV2"},
102 {"DecodeBase64"},
103 {"DecodePaddedRaw"},
104 {"DecodeProtoV2"},
105 {"DecodeRaw"},
106 {"DeleteSessionTensor"},
107 {"DenseToCSRSparseMatrix"},
108 {"DenseToDenseSetOperation"},
109 {"DenseToSparseSetOperation"},
110 {"DepthToSpace"},
111 {"DepthwiseConv2dNativeBackpropFilter", 1, {1}},
112 {"DepthwiseConv2dNativeBackpropInput", 1, {0}},
113 {"Diag"},
114 {"DiagPart"},
115 {"DrawBoundingBoxes"},
116 {"EditDistance"},
117 {"Elu"},
118 {"EncodeBase64"},
119 {"EnsureShape"},
120 {"Enter"},
121 {"Equal"},
122 {"Erfinv"},
123 {"Exit"},
124 {"Exp"},
125 {"ExpandDims", 1, {1}},
126 {"ExtractGlimpse"},
127 {"FFT"},
128 {"FFT2D"},
129 {"FFT3D"},
130 {"Fill"},
131 {"FixedLengthRecordReader"},
132 {"Floor"},
133 {"FloorDiv"},
134 {"FusedBatchNorm", 1, {2}},
135 {"FusedBatchNormGradV3", 1, {5}},
136 {"FusedBatchNormV2", 1, {2}},
137 {"FusedBatchNormV3", 1, {2}},
138 {"GenerateBoundingBoxProposals"},
139 {"GenerateVocabRemapping"},
140 {"GetSessionHandle"},
141 {"GetSessionHandleV2"},
142 {"GetSessionTensor"},
143 {"Greater"},
144 {"GreaterEqual"},
145 {"HSVToRGB"},
146 {"HashTable"},
147 {"HashTableV2"},
148 {"HistogramSummary"},
149 {"IFFT"},
150 {"IFFT2D"},
151 {"IFFT3D"},
152 {"Identity"},
153 {"IdentityN"},
154 {"IdentityReader"},
155 {"Imag"},
156 {"ImageProjectiveTransformV2", 1, {2}},
157 {"ImageProjectiveTransformV3", 2, {2, 3}},
158 {"ImageSummary"},
159 {"InitializeTable"},
160 {"InitializeTableFromTextFile"},
161 {"InitializeTableFromTextFileV2"},
162 {"InitializeTableV2"},
163 {"Inv"},
164 {"Invert"},
165 {"InvertPermutation"},
166 {"IsotonicRegression"},
167 {"LMDBReader"},
168 {"LeakyReluGrad", 1, {0}},
169 {"LeftShift"},
170 {"Less"},
171 {"LessEqual"},
172 {"LinSpace"},
173 {"LoadAndRemapMatrix"},
174 {"LogSoftmax"},
175 {"LogicalAnd"},
176 {"LogicalNot"},
177 {"LogicalOr"},
178 {"LookupTableFind"},
179 {"LookupTableFindV2"},
180 {"LookupTableInsert"},
181 {"LookupTableInsertV2"},
182 {"LookupTableSize"},
183 {"LookupTableSizeV2"},
184 {"LoopCond"},
185 {"MatrixBandPart", 1, {0}},
186 {"MatrixDiag"},
187 {"MatrixDiagPartV2", 1, {2}},
188 {"MatrixDiagPartV3", 1, {2}},
189 {"MatrixDiagV2", 4, {0, 2, 3, 4}},
190 {"MatrixDiagV3", 4, {0, 2, 3, 4}},
191 {"MatrixInverse"},
192 {"MatrixSetDiagV2", 1, {0}},
193 {"MatrixSetDiagV3", 1, {0}},
194 {"MatrixSolve", 1, {1}},
195 {"MatrixSquareRoot"},
196 {"MaxPool3DGrad", 1, {2}},
197 {"MaxPool3DGradGrad", 1, {2}},
198 {"MaxPoolGrad", 1, {2}},
199 {"MaxPoolGradGrad", 1, {2}},
200 {"MaxPoolGradV2", 1, {2}},
201 {"MirrorPad", 1, {0}},
202 {"MirrorPadGrad", 1, {0}},
203 {"Multinomial"},
204 {"MutableDenseHashTable"},
205 {"MutableDenseHashTableV2"},
206 {"MutableHashTable"},
207 {"MutableHashTableOfTensors"},
208 {"MutableHashTableOfTensorsV2"},
209 {"MutableHashTableV2"},
210 {"NcclAllReduce"},
211 {"NcclBroadcast"},
212 {"Ndtri"},
213 {"Neg"},
214 {"NextIteration"},
215 {"NonMaxSuppression"},
216 {"NonMaxSuppressionV2"},
217 {"NonMaxSuppressionWithOverlaps"},
218 {"NotEqual"},
219 {"NthElement", 1, {1}},
220 {"OneHot"},
221 {"OnesLike"},
222 {"OptionalGetValue"},
223 {"Pack"},
224 {"ParameterizedTruncatedNormal"},
225 {"ParseTensor"},
226 {"PlaceholderWithDefault"},
227 {"PopulationCount"},
228 {"PreventGradient"},
229 {"QuantizeAndDequantize"},
230 {"QuantizeAndDequantizeV2"},
231 {"QuantizeAndDequantizeV3"},
232 {"QuantizeAndDequantizeV4Grad", 1, {3}},
233 {"QueueClose"},
234 {"QueueDequeue"},
235 {"QueueDequeueMany"},
236 {"QueueDequeueUpTo"},
237 {"QueueSize"},
238 {"RaggedRange"},
239 {"RandomCrop"},
240 {"RandomIndexShuffle"},
241 {"RandomShuffle"},
242 {"RandomStandardNormal"},
243 {"RandomUniform"},
244 {"Range"},
245 {"Rank"},
246 {"ReadVariableOp"},
247 {"ReaderNumRecordsProduced"},
248 {"ReaderNumWorkUnitsCompleted"},
249 {"ReaderRead"},
250 {"ReaderReadUpTo"},
251 {"ReaderReset"},
252 {"ReaderRestoreState"},
253 {"ReaderSerializeState"},
254 {"Real"},
255 {"Reciprocal"},
256 {"ReduceJoin"},
257 {"RefEnter"},
258 {"RefExit"},
259 {"RefIdentity"},
260 {"RefNextIteration"},
261 {"RegexReplace"},
262 {"Relu"},
263 {"Relu6"},
264 {"Relu6Grad", 1, {0}},
265 {"ReluGrad", 1, {0}},
266 {"Reshape", 1, {1}},
267 {"ResizeBicubic", 1, {1}},
268 {"ResizeBilinear", 1, {1}},
269 {"ResizeNearestNeighbor", 1, {1}},
270 {"Reverse", 1, {0}},
271 {"ReverseSequence", 1, {0}},
272 {"ReverseV2", 1, {0}},
273 {"RightShift"},
274 {"Rint"},
275 {"Roll", 1, {0}},
276 {"Round"},
277 {"Rsqrt"},
278 {"SampleDistortedBoundingBox"},
279 {"SampleDistortedBoundingBoxV2"},
280 {"ScalarSummary"},
281 {"ScaleAndTranslate", 1, {1}},
282 {"ScatterAdd"},
283 {"ScatterDiv"},
284 {"ScatterMul"},
285 {"ScatterNd", 2, {1, 2}},
286 {"ScatterNdAdd"},
287 {"ScatterNdNonAliasingAdd", 2, {0, 2}},
288 {"ScatterNdSub"},
289 {"ScatterNdUpdate"},
290 {"ScatterSub"},
291 {"SdcaFprint"},
292 {"SegmentSum", 1, {0}},
293 {"Select", 1, {2}},
294 {"Selu"},
295 {"SerializeTensor"},
296 {"SetSize"},
297 {"Shape"},
298 {"Sigmoid"},
299 {"Size"},
300 {"Slice", 1, {2}},
301 {"Softmax"},
302 {"SoftmaxCrossEntropyWithLogits", 1, {1}},
303 {"SpaceToBatch", 1, {0}},
304 {"SpaceToBatchND", 1, {0}},
305 {"SpaceToDepth"},
306 {"SparseAdd", 3, {2, 5, 6}},
307 {"SparseAddGrad"},
308 {"SparseDenseCwiseAdd"},
309 {"SparseFillEmptyRows"},
310 {"SparseMatrixMul"},
311 {"SparseMatrixNNZ"},
312 {"SparseMatrixSoftmax"},
313 {"SparseMatrixTranspose"},
314 {"SparseMatrixZeros"},
315 {"SparseReduceSum", 1, {1}},
316 {"SparseReorder", 1, {1}},
317 {"SparseSegmentMeanWithNumSegments", 1, {3}},
318 {"SparseSegmentSqrtNWithNumSegments", 1, {3}},
319 {"SparseSegmentSumWithNumSegments", 1, {3}},
320 {"SparseSlice", 2, {2, 4}},
321 {"SparseSoftmax", 1, {1}},
322 {"SparseSoftmaxCrossEntropyWithLogits", 1, {1}},
323 {"SparseSparseMaximum"},
324 {"SparseSparseMinimum"},
325 {"SparseTensorDenseAdd", 3, {1, 2, 3}},
326 {"SparseTensorToCSRSparseMatrix"},
327 {"SparseToSparseSetOperation"},
328 {"Split", 1, {1}},
329 {"Sqrt"},
330 {"SqrtGrad", 1, {1}},
331 {"Stack"},
332 {"StackClose"},
333 {"StackPop"},
334 {"StackPush"},
335 {"StatelessCase"},
336 {"StatelessMultinomial"},
337 {"StatelessParameterizedTruncatedNormal", 1, {1}},
338 {"StatelessRandomBinomial"},
339 {"StatelessRandomGammaV2", 1, {1}},
340 {"StatelessRandomNormal"},
341 {"StatelessRandomNormalV2"},
342 {"StatelessRandomPoisson"},
343 {"StatelessRandomUniform"},
344 {"StatelessRandomUniformFullInt"},
345 {"StatelessRandomUniformFullIntV2"},
346 {"StatelessRandomUniformInt"},
347 {"StatelessRandomUniformIntV2"},
348 {"StatelessRandomUniformV2"},
349 {"StatelessTruncatedNormal"},
350 {"StatelessTruncatedNormalV2"},
351 {"StopGradient"},
352 {"StridedSliceGrad", 2, {0, 4}},
353 {"StringSplit"},
354 {"StringToHashBucket"},
355 {"StringToHashBucketFast"},
356 {"StringToHashBucketStrong"},
357 {"StringToNumber"},
358 {"TFRecordReader"},
359 {"Tanh"},
360 {"TensorArray"},
361 {"TensorArrayClose"},
362 {"TensorArrayCloseV2"},
363 {"TensorArrayCloseV3"},
364 {"TensorArrayGrad"},
365 {"TensorArrayGradV2"},
366 {"TensorArrayGradV3"},
367 {"TensorArrayGradWithShape"},
368 {"TensorArrayScatter", 2, {2, 3}},
369 {"TensorArrayScatterV2", 2, {2, 3}},
370 {"TensorArrayScatterV3", 2, {2, 3}},
371 {"TensorArraySize"},
372 {"TensorArraySizeV2"},
373 {"TensorArraySizeV3"},
374 {"TensorArraySplit", 3, {1, 2, 3}},
375 {"TensorArraySplitV2", 3, {1, 2, 3}},
376 {"TensorArraySplitV3", 3, {1, 2, 3}},
377 {"TensorArrayV2"},
378 {"TensorArrayV3"},
379 {"TensorArrayWrite", 2, {2, 3}},
380 {"TensorArrayWriteV2", 2, {2, 3}},
381 {"TensorArrayWriteV3", 2, {2, 3}},
382 {"TensorListConcatLists"},
383 {"TensorListConcatV2", 2, {1, 2}},
384 {"TensorListElementShape"},
385 {"TensorListFromTensor", 1, {1}},
386 {"TensorListGetItem", 1, {2}},
387 {"TensorListLength"},
388 {"TensorListPopBack"},
389 {"TensorListPushBack", 1, {0}},
390 {"TensorListPushBackBatch"},
391 {"TensorListScatter", 1, {2}},
392 {"TensorListScatterV2", 2, {2, 3}},
393 {"TensorListStack"},
394 {"TensorScatterAdd", 2, {0, 2}},
395 {"TensorScatterSub", 2, {0, 2}},
396 {"TensorScatterUpdate", 1, {0}},
397 {"TensorStridedSliceUpdate", 1, {0}},
398 {"TensorSummary"},
399 {"TensorSummaryV2"},
400 {"TextLineReader"},
401 {"Timestamp"},
402 {"TopKV2", 1, {1}},
403 {"Transpose", 1, {0}},
404 {"TridiagonalSolve", 1, {1}},
405 {"TruncateDiv"},
406 {"TruncatedNormal"},
407 {"Unpack"},
408 {"UnsortedSegmentSum", 2, {0, 2}},
409 {"VarIsInitializedOp"},
410 {"VariableShape"},
411 {"WholeFileReader"},
412 {"XlaClusterOutput"},
413 {"XlaSharding"},
414 {"XlaSpmdShardToFullShape"},
415 {"ZerosLike"},
416 {"_EagerConst"},
417 {"VarHandleOp"},
418 }};
419 static const auto &m = *OpGradientInfoInit(a);
420
421 auto it = m.find(op_name);
422 if (it != m.end()) {
423 return it->second;
424 }
425 return absl::nullopt;
426}
427
428absl::optional<tensorflow::gtl::FlatSet<int>> OpGradientUnusedOutputIndices(
429 const tensorflow::string &op_name) {
430 static std::array<OpIndexInfo, 483> a = {{
431 {"Abs"},
432 {"AccumulateNV2"},
433 {"Acos"},
434 {"Add"},
435 {"AddN"},
436 {"AddV2"},
437 {"AllToAll"},
438 {"Angle"},
439 {"ApproxTopK", 1, {0}},
440 {"ApproximateEqual"},
441 {"ArgMax"},
442 {"ArgMin"},
443 {"AsString"},
444 {"Asin"},
445 {"Assert"},
446 {"Assign"},
447 {"AssignAdd"},
448 {"AssignSub"},
449 {"Atan"},
450 {"Atan2"},
451 {"Atanh"},
452 {"AudioSummary"},
453 {"AudioSummaryV2"},
454 {"AvgPool"},
455 {"AvgPool3D"},
456 {"AvgPool3DGrad"},
457 {"AvgPoolGrad"},
458 {"BatchMatMul"},
459 {"BatchMatMulV2"},
460 {"BatchMatMulV3"},
461 {"BatchNormWithGlobalNormalization"},
462 {"BatchToSpace"},
463 {"BatchToSpaceND"},
464 {"BesselI0"},
465 {"BesselJ0"},
466 {"BesselK0"},
467 {"BesselY0"},
468 {"Betainc"},
469 {"BiasAdd"},
470 {"BiasAddGrad"},
471 {"BiasAddV1"},
472 {"BitwiseAnd"},
473 {"BitwiseOr"},
474 {"BitwiseXor"},
475 {"BroadcastGradientArgs"},
476 {"BroadcastTo"},
477 {"CSRSparseMatrixToDense"},
478 {"CSRSparseMatrixToSparseTensor", 1, {1}},
479 {"CTCGreedyDecoder"},
480 {"CTCLoss", 1, {0}},
481 {"CTCLossV2", 1, {0}},
482 {"Cast"},
483 {"Ceil"},
484 {"CheckNumerics"},
485 {"CheckNumericsV2"},
486 {"CollectivePermute"},
487 {"Complex"},
488 {"CompositeTensorVariantFromComponents"},
489 {"Concat"},
490 {"ConcatV2"},
491 {"Conj"},
492 {"ConjugateTranspose"},
493 {"Const"},
494 {"Conv2D"},
495 {"Conv2DBackpropFilter"},
496 {"Conv2DBackpropInput"},
497 {"Conv3D"},
498 {"Conv3DBackpropFilterV2"},
499 {"Conv3DBackpropInputV2"},
500 {"Cos"},
501 {"Cosh"},
502 {"CropAndResize"},
503 {"Cross"},
504 {"CrossReplicaSum"},
505 {"Cumprod"},
506 {"Cumsum"},
507 {"DebugGradientIdentity"},
508 {"DebugGradientRefIdentity"},
509 {"DebugIdentityV2"},
510 {"DecodeBase64"},
511 {"DecodePaddedRaw"},
512 {"DecodeRaw"},
513 {"DeleteSessionTensor"},
514 {"DenseToCSRSparseMatrix"},
515 {"DenseToDenseSetOperation"},
516 {"DenseToSparseSetOperation"},
517 {"DepthToSpace"},
518 {"DepthwiseConv2dNative"},
519 {"DepthwiseConv2dNativeBackpropFilter"},
520 {"DepthwiseConv2dNativeBackpropInput"},
521 {"Diag"},
522 {"DiagPart"},
523 {"Digamma"},
524 {"Dilation2D"},
525 {"Div"},
526 {"DivNoNan"},
527 {"DrawBoundingBoxes"},
528 {"DynamicPartition"},
529 {"EditDistance"},
530 {"Einsum"},
531 {"EluGrad"},
532 {"EncodeBase64"},
533 {"EncodeProto"},
534 {"EnsureShape"},
535 {"Enter"},
536 {"Equal"},
537 {"Erf"},
538 {"Erfc"},
539 {"Exit"},
540 {"ExpandDims"},
541 {"Expint"},
542 {"Expm1"},
543 {"ExtractGlimpse"},
544 {"FFT"},
545 {"FFT2D"},
546 {"FFT3D"},
547 {"FakeQuantWithMinMaxArgs"},
548 {"FakeQuantWithMinMaxVars"},
549 {"FakeQuantWithMinMaxVarsPerChannel"},
550 {"Fill"},
551 {"FixedLengthRecordReader"},
552 {"Floor"},
553 {"FloorDiv"},
554 {"FloorMod"},
555 {"FractionalAvgPool", 1, {0}},
556 {"FresnelCos"},
557 {"FresnelSin"},
558 {"FusedBatchNorm", 3, {0, 1, 2}},
559 {"FusedBatchNormGrad"},
560 {"FusedBatchNormGradV2"},
561 {"FusedBatchNormGradV3"},
562 {"FusedBatchNormV2", 3, {0, 1, 2}},
563 {"FusedBatchNormV3", 3, {0, 1, 2}},
564 {"Gather"},
565 {"GatherNd"},
566 {"GatherV2"},
567 {"GenerateBoundingBoxProposals"},
568 {"GenerateVocabRemapping"},
569 {"GetSessionHandle"},
570 {"GetSessionHandleV2"},
571 {"GetSessionTensor"},
572 {"Greater"},
573 {"GreaterEqual"},
574 {"HSVToRGB"},
575 {"HashTable"},
576 {"HashTableV2"},
577 {"HistogramSummary"},
578 {"IFFT"},
579 {"IFFT2D"},
580 {"IFFT3D"},
581 {"IRFFT"},
582 {"IRFFT2D"},
583 {"Identity"},
584 {"IdentityN"},
585 {"IdentityReader"},
586 {"Igamma"},
587 {"Igammac"},
588 {"Imag"},
589 {"ImageProjectiveTransformV2"},
590 {"ImageProjectiveTransformV3"},
591 {"ImageSummary"},
592 {"InitializeTable"},
593 {"InitializeTableFromTextFile"},
594 {"InitializeTableFromTextFileV2"},
595 {"InitializeTableV2"},
596 {"InvGrad"},
597 {"Invert"},
598 {"InvertPermutation"},
599 {"IsotonicRegression", 1, {0}},
600 {"L2Loss"},
601 {"LMDBReader"},
602 {"LeakyRelu"},
603 {"LeakyReluGrad"},
604 {"LeftShift"},
605 {"Less"},
606 {"LessEqual"},
607 {"Lgamma"},
608 {"LinSpace"},
609 {"LoadAndRemapMatrix"},
610 {"Log"},
611 {"Log1p"},
612 {"LogMatrixDeterminant", 1, {0}},
613 {"LogicalAnd"},
614 {"LogicalNot"},
615 {"LogicalOr"},
616 {"LookupTableFind"},
617 {"LookupTableFindV2"},
618 {"LookupTableInsert"},
619 {"LookupTableInsertV2"},
620 {"LookupTableSize"},
621 {"LookupTableSizeV2"},
622 {"LoopCond"},
623 {"MatMul"},
624 {"MatrixBandPart"},
625 {"MatrixDiag"},
626 {"MatrixDiagPart"},
627 {"MatrixDiagPartV2"},
628 {"MatrixDiagPartV3"},
629 {"MatrixDiagV2"},
630 {"MatrixDiagV3"},
631 {"MatrixSetDiag"},
632 {"MatrixSetDiagV2"},
633 {"MatrixSetDiagV3"},
634 {"MaxPool3DGrad"},
635 {"MaxPool3DGradGrad"},
636 {"MaxPoolGrad"},
637 {"MaxPoolGradGrad"},
638 {"MaxPoolGradV2"},
639 {"MaxPoolWithArgmax", 1, {0}},
640 {"Maximum"},
641 {"Merge", 1, {0}},
642 {"MergeSummary"},
643 {"Minimum"},
644 {"MirrorPad"},
645 {"MirrorPadGrad"},
646 {"Mul"},
647 {"MulNoNan"},
648 {"Multinomial"},
649 {"MutableDenseHashTable"},
650 {"MutableDenseHashTableV2"},
651 {"MutableHashTable"},
652 {"MutableHashTableOfTensors"},
653 {"MutableHashTableOfTensorsV2"},
654 {"MutableHashTableV2"},
655 {"NcclAllReduce"},
656 {"NcclBroadcast"},
657 {"NcclReduce"},
658 {"Neg"},
659 {"NextAfter"},
660 {"NextIteration"},
661 {"NonMaxSuppression"},
662 {"NonMaxSuppressionV2"},
663 {"NonMaxSuppressionWithOverlaps"},
664 {"NotEqual"},
665 {"OneHot"},
666 {"OnesLike"},
667 {"OptionalFromValue"},
668 {"OptionalGetValue"},
669 {"Pack"},
670 {"Pad"},
671 {"PadV2"},
672 {"ParameterizedTruncatedNormal"},
673 {"ParseTensor"},
674 {"PlaceholderWithDefault"},
675 {"Polygamma"},
676 {"PopulationCount"},
677 {"PreventGradient"},
678 {"Print"},
679 {"Prod"},
680 {"QuantizeAndDequantize"},
681 {"QuantizeAndDequantizeV2"},
682 {"QuantizeAndDequantizeV3"},
683 {"QuantizeAndDequantizeV4"},
684 {"QuantizeAndDequantizeV4Grad"},
685 {"QueueClose"},
686 {"QueueEnqueue"},
687 {"QueueEnqueueMany"},
688 {"QueueSize"},
689 {"RFFT"},
690 {"RFFT2D"},
691 {"RaggedGather"},
692 {"RaggedRange"},
693 {"RaggedTensorToSparse"},
694 {"RaggedTensorToTensor"},
695 {"RaggedTensorToVariant"},
696 {"RandomCrop"},
697 {"RandomIndexShuffle"},
698 {"RandomShuffle"},
699 {"RandomStandardNormal"},
700 {"RandomUniform"},
701 {"Range"},
702 {"Rank"},
703 {"ReadVariableOp"},
704 {"ReaderNumRecordsProduced"},
705 {"ReaderNumWorkUnitsCompleted"},
706 {"ReaderRead"},
707 {"ReaderReadUpTo"},
708 {"ReaderReset"},
709 {"ReaderRestoreState"},
710 {"ReaderSerializeState"},
711 {"Real"},
712 {"RealDiv"},
713 {"ReciprocalGrad"},
714 {"ReduceJoin"},
715 {"RefEnter"},
716 {"RefExit"},
717 {"RefIdentity"},
718 {"RefMerge", 1, {0}},
719 {"RefNextIteration"},
720 {"RefSwitch"},
721 {"RegexReplace"},
722 {"Relu6Grad"},
723 {"ReluGrad"},
724 {"Reshape"},
725 {"ResizeBicubic"},
726 {"ResizeBilinear"},
727 {"ResizeNearestNeighbor"},
728 {"ResourceGather"},
729 {"ResourceGatherNd"},
730 {"Reverse"},
731 {"ReverseSequence"},
732 {"ReverseV2"},
733 {"RightShift"},
734 {"Rint"},
735 {"Roll"},
736 {"Round"},
737 {"RsqrtGrad"},
738 {"SampleDistortedBoundingBox"},
739 {"SampleDistortedBoundingBoxV2"},
740 {"ScalarSummary"},
741 {"ScaleAndTranslate"},
742 {"ScatterAdd"},
743 {"ScatterDiv"},
744 {"ScatterMul"},
745 {"ScatterNd"},
746 {"ScatterNdAdd"},
747 {"ScatterNdNonAliasingAdd"},
748 {"ScatterNdSub"},
749 {"ScatterNdUpdate"},
750 {"ScatterSub"},
751 {"SdcaFprint"},
752 {"SdcaShrinkL1"},
753 {"SegmentMean"},
754 {"SegmentSum"},
755 {"Select"},
756 {"SeluGrad"},
757 {"SerializeTensor"},
758 {"SetSize"},
759 {"Shape"},
760 {"SigmoidGrad"},
761 {"Sign"},
762 {"Sin"},
763 {"Sinh"},
764 {"Size"},
765 {"SoftmaxCrossEntropyWithLogits", 1, {0}},
766 {"Softplus"},
767 {"SoftplusGrad"},
768 {"Softsign"},
769 {"SpaceToBatch"},
770 {"SpaceToBatchND"},
771 {"SpaceToDepth"},
772 {"SparseAdd", 2, {1, 2}},
773 {"SparseAddGrad"},
774 {"SparseConcat"},
775 {"SparseDenseCwiseAdd"},
776 {"SparseDenseCwiseDiv"},
777 {"SparseDenseCwiseMul"},
778 {"SparseFillEmptyRows", 3, {0, 1, 2}},
779 {"SparseMatMul"},
780 {"SparseMatrixAdd"},
781 {"SparseMatrixMatMul"},
782 {"SparseMatrixMul"},
783 {"SparseMatrixNNZ"},
784 {"SparseMatrixSparseMatMul"},
785 {"SparseMatrixTranspose"},
786 {"SparseMatrixZeros"},
787 {"SparseReduceSum"},
788 {"SparseReorder"},
789 {"SparseSegmentMean"},
790 {"SparseSegmentMeanWithNumSegments"},
791 {"SparseSegmentSqrtN"},
792 {"SparseSegmentSqrtNWithNumSegments"},
793 {"SparseSegmentSum"},
794 {"SparseSegmentSumWithNumSegments"},
795 {"SparseSlice", 2, {1, 2}},
796 {"SparseSoftmaxCrossEntropyWithLogits", 1, {0}},
797 {"SparseSparseMaximum"},
798 {"SparseSparseMinimum"},
799 {"SparseTensorDenseAdd"},
800 {"SparseTensorDenseMatMul"},
801 {"SparseTensorToCSRSparseMatrix"},
802 {"SparseToDense"},
803 {"SparseToSparseSetOperation"},
804 {"Spence"},
805 {"Split"},
806 {"SplitV"},
807 {"Square"},
808 {"SquaredDifference"},
809 {"Squeeze"},
810 {"Stack"},
811 {"StackClose"},
812 {"StackPop"},
813 {"StackPush"},
814 {"StatelessMultinomial"},
815 {"StatelessRandomBinomial"},
816 {"StatelessRandomNormal"},
817 {"StatelessRandomNormalV2"},
818 {"StatelessRandomPoisson"},
819 {"StatelessRandomUniform"},
820 {"StatelessRandomUniformFullInt"},
821 {"StatelessRandomUniformFullIntV2"},
822 {"StatelessRandomUniformInt"},
823 {"StatelessRandomUniformIntV2"},
824 {"StatelessRandomUniformV2"},
825 {"StatelessTruncatedNormal"},
826 {"StatelessTruncatedNormalV2"},
827 {"StopGradient"},
828 {"StridedSlice"},
829 {"StridedSliceGrad"},
830 {"StringJoin"},
831 {"StringSplit"},
832 {"StringToHashBucket"},
833 {"StringToHashBucketFast"},
834 {"StringToHashBucketStrong"},
835 {"StringToNumber"},
836 {"Sub"},
837 {"Sum"},
838 {"Switch"},
839 {"TFRecordReader"},
840 {"TPUEmbeddingActivations"},
841 {"TPUReplicatedInput"},
842 {"Tan"},
843 {"TanhGrad"},
844 {"TensorArray"},
845 {"TensorArrayClose"},
846 {"TensorArrayCloseV2"},
847 {"TensorArrayCloseV3"},
848 {"TensorArrayConcat", 1, {0}},
849 {"TensorArrayConcatV2", 1, {0}},
850 {"TensorArrayConcatV3", 1, {0}},
851 {"TensorArrayGather"},
852 {"TensorArrayGatherV2"},
853 {"TensorArrayGatherV3"},
854 {"TensorArrayGrad"},
855 {"TensorArrayGradV2"},
856 {"TensorArrayGradV3"},
857 {"TensorArrayGradWithShape"},
858 {"TensorArrayRead"},
859 {"TensorArrayReadV2"},
860 {"TensorArrayReadV3"},
861 {"TensorArraySize"},
862 {"TensorArraySizeV2"},
863 {"TensorArraySizeV3"},
864 {"TensorArrayV2"},
865 {"TensorArrayV3"},
866 {"TensorListConcat", 1, {0}},
867 {"TensorListConcatLists"},
868 {"TensorListConcatV2", 1, {0}},
869 {"TensorListElementShape"},
870 {"TensorListGather"},
871 {"TensorListGetItem"},
872 {"TensorListLength"},
873 {"TensorListPushBack"},
874 {"TensorListPushBackBatch"},
875 {"TensorListResize"},
876 {"TensorListScatter"},
877 {"TensorListScatterIntoExistingList"},
878 {"TensorListScatterV2"},
879 {"TensorListSetItem"},
880 {"TensorListSplit"},
881 {"TensorListStack"},
882 {"TensorScatterAdd"},
883 {"TensorScatterSub"},
884 {"TensorScatterUpdate"},
885 {"TensorStridedSliceUpdate"},
886 {"TensorSummary"},
887 {"TensorSummaryV2"},
888 {"TextLineReader"},
889 {"Tile"},
890 {"Timestamp"},
891 {"TopK", 1, {0}},
892 {"TopKV2", 1, {0}},
893 {"Transpose"},
894 {"TridiagonalMatMul"},
895 {"TruncateDiv"},
896 {"TruncatedNormal"},
897 {"Unpack"},
898 {"UnsortedSegmentSum"},
899 {"VarIsInitializedOp"},
900 {"VariableShape"},
901 {"WholeFileReader"},
902 {"Xdivy"},
903 {"XlaClusterOutput"},
904 {"XlaEinsum"},
905 {"XlaSharding"},
906 {"XlaSpmdFullToShardShape"},
907 {"XlaSpmdShardToFullShape"},
908 {"Xlog1py"},
909 {"Xlogy"},
910 {"ZerosLike"},
911 {"Zeta"},
912 {"_EagerConst"},
913 {"VarHandleOp"},
914 }};
915 static const auto &m = *OpGradientInfoInit(a);
916
917 auto it = m.find(op_name);
918 if (it != m.end()) {
919 return it->second;
920 }
921 return absl::nullopt;
922}
923