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

Function _get_distribution

tensorflow/tools/compatibility/tf_upgrade_v2.py:2174–2185  ·  view source on GitHub ↗

Returns an AST matching the following: ("uniform" if (old_value) else "truncated_normal")

(old_value)

Source from the content-addressed store, hash-verified

2172 Returns: The new node
2173 """
2174 def _get_distribution(old_value):
2175 """Returns an AST matching the following:
2176 ("uniform" if (old_value) else "truncated_normal")
2177 """
2178 dist = pasta.parse("\"uniform\" if old_value else \"truncated_normal\"")
2179 ifexpr = dist.body[0].value
2180 pasta.ast_utils.replace_child(ifexpr, ifexpr.test, old_value)
2181
2182 pasta.base.formatting.set(dist, "prefix", "(")
2183 pasta.base.formatting.set(dist, "suffix", ")")
2184
2185 return dist
2186
2187 found_distribution = False
2188 for keyword_arg in node.keywords:

Calls 2

parseMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected