什么是我输入的合适占位符

时间:2023-01-28 07:31:24

I have a 1k rows and 14 columns dataframe containing numpy arrays like shown below.

我有一个1k行和14列数据帧包含numpy数组,如下所示。

Here a subset of 2 rows and 3 columns :

这里是2行3列的子集:

[5,4,74,-12] [  78,1,2,-9]    [5 ,1,1,2] 

[10,4,4,-1]  [  8,15,21,-19]  [1,1,0,0] 

where each cell is a numpy array of shape (4,1).

其中每个单元格是一个numpy形状的阵列(4,1)。

I couldn't find the right placeholder to input my whole dataframe as it needs to be processed by row batches.

我找不到合适的占位符来输入我的整个数据帧,因为它需要按行批处理。

Could anyone have an idea ?

谁能有想法?

I tried this to find the proper placeholder for my dataframe but its not correct:

我试过这个找到我的数据帧的正确占位符,但它不正确:

x = tf.placeholder(tf.int32,[None,14],name='x') 

with tf.Session() as sess:
     print(sess.run(x,feed_dict={x:Data}))

It gives ValueError: setting an array element with a sequence.  

Does anyone have an idea please ?

有人有想法吗?

1 个解决方案

#1


0  

You did not specify in which format your data is available, so I assume it is a numpy array. In this case, you can do it like this:

您没有指定数据的可用格式,因此我假设它是一个numpy数组。在这种情况下,您可以这样做:

n_columns = 14
n_elements_per_column = 4

x = tf.placeholder(tf.int32, [None, n_columns, n_elements_per_column], name='x') 

with tf.Session() as sess:
     print(sess.run(x,feed_dict={x:Data}))

#1


0  

You did not specify in which format your data is available, so I assume it is a numpy array. In this case, you can do it like this:

您没有指定数据的可用格式,因此我假设它是一个numpy数组。在这种情况下,您可以这样做:

n_columns = 14
n_elements_per_column = 4

x = tf.placeholder(tf.int32, [None, n_columns, n_elements_per_column], name='x') 

with tf.Session() as sess:
     print(sess.run(x,feed_dict={x:Data}))