In [6]:
import tensorflow as tf
import numpy as np
In [2]:
import csv
In [3]:
file = open('test.csv')
print(file)
In [4]:
reader = csv.reader(file)
In [5]:
for row in reader:
print(row)
In [8]:
tensor_1d = np.array([1.3,1,4.0,23.99])
In [9]:
print(tensor_1d)
In [10]:
tensor_1d.ndim
Out[10]:
In [11]:
tensor_1d.shape
Out[11]:
In [12]:
tensor_1d.dtype
Out[12]:
In [13]:
tf_tensor = tf.convert_to_tensor(tensor_1d,dtype=tf.float64)
In [14]:
print(tf_tensor)
In [15]:
sess = tf.Session()
In [16]:
sess.close()
In [19]:
#with구분을 사용하면 Session의 close() 호출을 자동으로 해준다.
with tf.Session() as sess:
print(sess.run(tf_tensor))
print(sess.run(tf_tensor[0]))
print(sess.run(tf_tensor[2]))
In [ ]: