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