Commit e63d8b7e authored by Yuxin Wu's avatar Yuxin Wu

update docs

parent 34e8d817
......@@ -15,7 +15,8 @@ The Tensorpack API brings speed and flexibility together.
Is TensorFlow Slow?
~~~~~~~~~~~~~~~~~~~~~
*******************
There is a common misconception,
but no, it's not slow. But it's not easy to write it in an efficient way.
......
......@@ -69,17 +69,30 @@ def humanize_time_delta(sec):
def change_env(name, val):
"""
Args:
name(str), val(str):
name(str): name of the env var
val(str or None): the value, or set to None to clear the env var.
Returns:
a context where the environment variable ``name`` being set to
``val``. It will be set back after the context exits.
"""
oldval = os.environ.get(name, None)
if val is None:
try:
del os.environ[name]
except KeyError:
pass
else:
os.environ[name] = val
yield
if oldval is None:
try:
del os.environ[name]
except KeyError:
pass
else:
os.environ[name] = oldval
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment