MCPcopy Index your code
hub / github.com/pytorch/pytorch / GetIndexFromGradientList

Function GetIndexFromGradientList

caffe2/python/core.py:467–476  ·  view source on GitHub ↗

A helper function to get the index from a gradient list, None if not matching.

(g_list, name)

Source from the content-addressed store, hash-verified

465
466
467def 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
479OpSSA = namedtuple('OpSSA', ['op', 'in_versions', 'out_versions'])

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…