every blog every motto: You can do more than you think.
0. Preface
Test code error, small note
1. Text
Test the following code,
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
import numpy as np
tensor = tf.constant(np.arange(12).reshape((3, 4,1)))
print(tensor)
temp = tf.sigmoid(tensor)
print(temp)
Error:
tensorflow.python.framework.errors_impl.NotFoundError: Could not find valid device for node.
Reason: tensor is a floating-point type to perform tf.sigmoid operations
after fixing:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
import numpy as np
tensor = tf.constant(np.arange(12).reshape((3, 4, 1)), dtype=tf.float32)
print(tensor)
temp = tf.sigmoid(tensor)
print(temp)
references
no