0

I have a text file of size (20480,8). I want the data in 4th column in to one array. I am able to do it using python as

file_pathname1 = os.path.join(os.path.expanduser('~'),'TF','1st_test', '20.10.22.12.09.13')
x= np.loadtext(file_pathname1)
y= x[:,4]
#print(np.shape(x))
print(np.shape(y))

I get the size of the y as (20480,)

but I am trying to copy the same as a tensor. How to access the data

file_pathname1 = os.path.join(os.path.expanduser('~'),'TF','1st_test', '20.10.22.12.09.13')
y = tf.read_file(file_pathname1)
sess = tf.Session()
sess.run(y)
print(y.get_shape())

I cant understand whether I have loaded the file correctly as I am getting it as empty array ()

0

1 Answer 1

1

found the solution posting if it helps someone

x1 = tf.constant(y,name = 'x1')
model = tf.initialize_all_variables()
with tf.Session() as session:
     session.run(model)
print(np.shape(session.run(x1)))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.