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