Add runtime type check in named_scope to ensure that name is a string.

PiperOrigin-RevId: 470177071
This commit is contained in:
Anselm Levskaya 2022-08-26 00:24:55 -07:00 committed by jax authors
parent 0cbdf858c7
commit 3c9178745b

View File

@ -3180,6 +3180,8 @@ def named_scope(
... logits = w.dot(x)
... return jax.nn.relu(logits)
"""
if not isinstance(name, str):
raise ValueError("named_scope name argument must be a string.")
with source_info_util.extend_name_stack(name):
yield