2017-12-23 6 views
1

私のプログラムは、最初の6行が入力であるCSVファイルを取り込みます。入力シェイプが3次元でないケラススローエラー

私が使用している入力定義する場合:

inputs = Input(shape=(2697, 6)) 

を2697年にはバッチサイズと6は、入力サイズです。私はInput(shape=(batch-size, input-size))が正しいことを知っています。入力チェックの際にエラー: とValueError:私はそれを実行したときに

は、しかし、私はメッセージを取得する3次元を持つことが期待INPUT_1を、しかし形状を持つ配列ました(2697年は、6)

はなぜkerasですこれを3次元形状として捉えていますか?

答えて

1

Kerasがこれを自動的に追加するので、バッチサイズディメンションを入力シェイプに配置しないでください。このため、2次元の入力形状が3次元になります。ただ、この行を変更:

inputs = Input(shape=(6,)) 
2

Inputドキュメントから:

Arguments

  • shape: A shape tuple (integer), not including the batch size. For instance, shape=(32,) indicates that the expected input will be batches of 32-dimensional vectors.

  • batch_shape: A shape tuple (integer), including the batch size. For instance, batch_shape=(10, 32) indicates that the expected input will be batches of 10 32-dimensional vectors. batch_shape=(None, 32) indicates batches of an arbitrary number of 32-dimensional vectors.

だから、あなただけのshape

Input(batch_shape=(2697, 6)) 

batch_shapeに変更することができ