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. ...@@ -15,7 +15,8 @@ The Tensorpack API brings speed and flexibility together.
Is TensorFlow Slow? Is TensorFlow Slow?
~~~~~~~~~~~~~~~~~~~~~ *******************
There is a common misconception, There is a common misconception,
but no, it's not slow. But it's not easy to write it in an efficient way. 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): ...@@ -69,17 +69,30 @@ def humanize_time_delta(sec):
def change_env(name, val): def change_env(name, val):
""" """
Args: 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: Returns:
a context where the environment variable ``name`` being set to a context where the environment variable ``name`` being set to
``val``. It will be set back after the context exits. ``val``. It will be set back after the context exits.
""" """
oldval = os.environ.get(name, None) oldval = os.environ.get(name, None)
if val is None:
try:
del os.environ[name]
except KeyError:
pass
else:
os.environ[name] = val os.environ[name] = val
yield yield
if oldval is None: if oldval is None:
try:
del os.environ[name] del os.environ[name]
except KeyError:
pass
else: else:
os.environ[name] = oldval 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