Skip to content

Instantly share code, notes, and snippets.

@nkpro2000sr
Last active September 10, 2020 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkpro2000sr/386b2af9a04450f6c46d9ce0ef0c4453 to your computer and use it in GitHub Desktop.
Save nkpro2000sr/386b2af9a04450f6c46d9ce0ef0c4453 to your computer and use it in GitHub Desktop.
To build TensorFlow from source in colab
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
with open(sys.argv[1], 'r') as target_txt:
targets = target_txt.read()
targets = targets.partition('\n\n')[0]
targets = targets.splitlines()[1:]
copts = []
for target in targets:
arg = target.split()
if len(arg) == 1:
continue
elif arg[1] == '[disabled]':
continue
elif arg[1] == '[default]':
continue
elif arg[1] == '[enabled]':
copts.append(arg[0])
else:
copts.append(''.join(arg))
with open(sys.argv[2], 'w') as target_arg:
target_arg.write(' '.join(['--copt='+copt for copt in copts]))
@nkpro2000sr
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment