Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Minor cleanups preparing for a patch releaase
Browse files Browse the repository at this point in the history
  • Loading branch information
Ludwig Schubert committed Jan 17, 2019
1 parent 1429c37 commit b24b223
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
3 changes: 3 additions & 0 deletions lucid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@

logging.basicConfig(level=logging.WARN)
del logging

# Lucid uses a fixed random seed for reproducability. Use to seed sources of randomness.
seed = 0
14 changes: 8 additions & 6 deletions lucid/misc/io/saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ def save_txt(object, handle, **kwargs):
handle.write(object)
elif isinstance(object, list):
for line in object:
if not isinstance(line, str):
line = repr(line)
if isinstance(line, str):
line = line.encode()
if not isinstance(line, bytes):
line_type = type(line)
line = repr(line).encode()
warnings.warn(
"`save_txt` was called with an array containing objects other than "
"strings; using `repr` to convert values to string."
"`save_txt` found an object of type {}; using `repr` to convert it to string.".format(line_type)
)
if not line.endswith("\n"):
line += "\n"
if not line.endswith(b"\n"):
line += b"\n"
handle.write(line)


Expand Down
3 changes: 3 additions & 0 deletions lucid/modelzoo/aligned_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# limitations under the License.
# ==============================================================================

"""Helper code for downloading and using previously collected aligned activations.
See recipes > collection for code that collected them in teh first place."""

from __future__ import absolute_import, division, print_function

from lucid.misc.io.sanitizing import sanitize
Expand Down
1 change: 1 addition & 0 deletions lucid/modelzoo/other_models/InceptionV1.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class InceptionV1(Model):
def post_import(self, scope):
_populate_inception_bottlenecks(scope)


InceptionV1.layers = _layers_from_list_of_dicts(InceptionV1, [
{'tags': ['conv'], 'name': 'conv2d0', 'depth': 64},
{'tags': ['conv'], 'name': 'conv2d1', 'depth': 64},
Expand Down
10 changes: 10 additions & 0 deletions tests/fixtures/multiline-array.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Line 0
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
Line 9

0 comments on commit b24b223

Please sign in to comment.