2017-09-18 11 views
0

私は1行の文章のデータセットを持っており、各文章は文脈に基づいたクラスに属しています。私は重要な単語の辞書を作成し、入力データを各機能が辞書の長さのベクトルである機能のリストに変換しました。 このデータをダイナミックLSTMセルに入力したいが、それを再形成する方法を理解することはできない。 私のbatch_size = 100、length_lexicon = 64、nRows_Input = 1000を考慮するマルチクラス分類のためにTensorFlowのLSTMセルにデータを供給する方法は?

答えて

0

numpy.reshapeを使用しないのはなぜですか?例えばhttps://docs.scipy.org/doc/numpy/reference/generated/numpy.reshape.html

>>> a = np.arange(6).reshape((3, 2)) >>> aarray([[0, 1], [2, 3],[4, 5]])

numpy.reshape¶

numpy.reshape(newshape、順序= 'Cこのドキュメントをチェックアウト ')

Gives a new shape to an array without changing its data. 
Parameters: 

a : array_like 

    Array to be reshaped. 

newshape : int or tuple of ints 

    The new shape should be compatible with the original shape. If an integer, then the result will be a 1-D array of that length. One 

形状寸法は-1にすることができます。この場合、値は から配列の長さおよび残りの次元から推測されます。

order : {‘C’, ‘F’, ‘A’}, optional 

    Read the elements of a using this index order, and place the elements into the reshaped array using this index order. ‘C’ means to 

リード/最後の軸 指数バック最も遅いを変える第一軸のインデックスに、最速の変化と、Cのようなインデックスの順序を使用して要素を書きます。 'F'は、Fortranのようなインデックス順 を使用して要素を読み書きすることを意味し、最初のインデックスは最も速く変化し、最後のインデックスは を最も遅く変更します。 'C'と 'F'オプションは、基本配列の メモリレイアウトを考慮せず、 インデックスの順序のみを参照してください。 'A'は、Fortranのようなインデックス の要素を読み書きすることを意味します。これは、aがメモリ内で連続している場合、そうでない場合はCのような順序です。

Returns: 

reshaped_array : ndarray 

    This will be a new view object if possible; otherwise, it will be a copy. Note there is no guarantee of the memory layout (C- or 

(Fortran連続した)戻り値の配列。

関連する問題