tensorflow pycharm 测试代码
# -*- coding:utf-8 -*-
# outhor: aihan time: 2019/1/17
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import tensorflow as tf
import numpy as np
tf.InteractiveSession()
#TensorFlow operations
a=tf.zeros((3,3))
b=tf.ones((3,3))
print(tf.reduce_sum(b,reduction_indices=1).eval())
print(a.get_shape())
a=np.zeros((3,3))
b=np.ones((3,3))
print(np.sum(b,axis=1))
print(a.shape)
由于有警告飘红,虽然不影响运行结果,强迫症的我还是去找了解决办法,加上这两行代码,就不飘红啦
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'