A helper function to get the index from a gradient list, None if not matching.
(g_list, name)
| 465 | |
| 466 | |
| 467 | def GetIndexFromGradientList(g_list, name): |
| 468 | """A helper function to get the index from a gradient list, None if not |
| 469 | matching.""" |
| 470 | for i, g in enumerate(g_list): |
| 471 | if g == name: |
| 472 | return i |
| 473 | elif type(g) is GradientSlice: |
| 474 | if (g.indices == name or g.values == name): |
| 475 | return i |
| 476 | return None |
| 477 | |
| 478 | |
| 479 | OpSSA = namedtuple('OpSSA', ['op', 'in_versions', 'out_versions']) |
no outgoing calls
no test coverage detected
searching dependent graphs…