MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / _get_arg_infos

Function _get_arg_infos

tensorflow/python/ops/ragged/ragged_dispatch.py:61–84  ·  view source on GitHub ↗

Returns an `_ArgInfo` for each argument of `func` specified by `arg_names`. Args: func: The function whose arguments should be described. arg_names: The names of the arguments to get info for. Returns: A tuple of `_ArgInfo`s.

(func, arg_names)

Source from the content-addressed store, hash-verified

59
60
61def _get_arg_infos(func, arg_names):
62 """Returns an `_ArgInfo` for each argument of `func` specified by `arg_names`.
63
64 Args:
65 func: The function whose arguments should be described.
66 arg_names: The names of the arguments to get info for.
67
68 Returns:
69 A tuple of `_ArgInfo`s.
70 """
71 arg_infos = []
72
73 # Inspect the func's argspec to find the position of each arg.
74 arg_spec = tf_inspect.getargspec(func)
75 for argname in arg_names:
76 assert isinstance(argname, str)
77 is_list = argname.startswith('[') and argname.endswith(']')
78 if is_list:
79 argname = argname[1:-1]
80 if argname not in arg_spec.args:
81 raise ValueError('Argument %r not found function in %s. Args=%s' %
82 (argname, func, arg_spec.args))
83 arg_infos.append(_ArgInfo(argname, arg_spec.args.index(argname), is_list))
84 return arg_infos
85
86
87def _is_convertible_to_tensor(value):

Callers 2

__init__Method · 0.85
ragged_op_listFunction · 0.85

Calls 2

appendMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected