Skip to content

Commit 61bb943

Browse files
authored
Update README.md
Update README.md compile instructions to match adding_an_op. from [adding_an_op](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/docs_src/extend/adding_an_op.md). Tested: compiled using the modified instructions and ran `python word2vec_optimized_test.py`. Fixes tensorflow/tensorflow#14620
1 parent 8e4a1e2 commit 61bb943

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tutorials/embedding/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ unzip -p source-archive.zip word2vec/trunk/questions-words.txt > questions-word
1919
rm text8.zip source-archive.zip
2020
```
2121

22-
You will need to compile the ops as follows:
22+
You will need to compile the ops as follows (See
23+
[Adding a New Op to TensorFlow](https://www.tensorflow.org/how_tos/adding_an_op/#building_the_op_library)
24+
for more details).:
2325

2426
```shell
25-
TF_INC=$(python -c 'import tensorflow as tf; print(tf.sysconfig.get_include())')
26-
g++ -std=c++11 -shared word2vec_ops.cc word2vec_kernels.cc -o word2vec_ops.so -fPIC -I $TF_INC -O2 -D_GLIBCXX_USE_CXX11_ABI=0
27+
TF_CFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
28+
TF_LFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )
29+
g++ -std=c++11 -shared word2vec_ops.cc word2vec_kernels.cc -o word2vec_ops.so -fPIC ${TF_CFLAGS[@]} ${TF_LFLAGS[@]} -O2 -D_GLIBCXX_USE_CXX11_ABI=0
2730
```
2831

2932
On Mac, add `-undefined dynamic_lookup` to the g++ command.
3033

31-
(For an explanation of what this is doing, see the tutorial on [Adding a New Op to TensorFlow](https://www.tensorflow.org/how_tos/adding_an_op/#building_the_op_library). The flag `-D_GLIBCXX_USE_CXX11_ABI=0` is included to support newer versions of gcc. However, if you compiled TensorFlow from source using gcc 5 or later, you may need to exclude the flag.)
34+
(The flag `-D_GLIBCXX_USE_CXX11_ABI=0` is included to support newer versions of gcc. However, if you compiled TensorFlow from source using gcc 5 or later, you may need to exclude the flag.)
3235
Then run using:
3336

3437
```shell

0 commit comments

Comments
 (0)