diff --git a/tensorflow/python/autograph/g3doc/pyct_tutorial.ipynb b/tensorflow/python/autograph/g3doc/pyct_tutorial.ipynb index 24862a8ce39..51abdf62396 100644 --- a/tensorflow/python/autograph/g3doc/pyct_tutorial.ipynb +++ b/tensorflow/python/autograph/g3doc/pyct_tutorial.ipynb @@ -153,7 +153,11 @@ "id": "kuT7J-xps_2Y" }, "source": [ - "There are a couple of context objects that most transformer objects like `CodeGenerator` use:" + "There are a couple of context objects that most transformer objects like `CodeGenerator` use.\n", + "\n", + "Of note here is `EntityInfo.namespace`, which contains the runtime values for all the global and closure names that the function has access to. Inside a transformer object, this is available under `self.ctx.info.namespace`.\n", + "\n", + "For example, if a function uses NumPy, its namespace will typically include `'np'`." ] }, { @@ -166,12 +170,14 @@ }, "outputs": [], "source": [ + "from tensorflow.python.autograph.pyct import inspect_utils\n", + "\n", "f_info = transformer.EntityInfo(\n", " name='f',\n", " source_code=source,\n", " source_file=None,\n", " future_features=(),\n", - " namespace=None)\n", + " namespace=inspect_utils.getnamespace(f))\n", "ctx = transformer.Context(f_info, None, None)" ] },