Skip to content

Module 6- Deep sequence modeling-RNN-LSTM.ipynb - DNN #1

@echokhan

Description

@echokhan

When using timeseries_dataset_from_array to create datasets, train_dataset, test_dataset and val_dataset had all uniform tensors except the last one which were partials, i.e. their samples and targets were as follows:

for samples, targets in train_dataset:
  if samples.shape != (batch_size, sequence_length, 14):
    print(samples.shape)
    print(targets.shape)

for samples, targets in test_dataset:
  if samples.shape != (batch_size, sequence_length, 14):
    print(samples.shape)
    print(targets.shape)

for samples, targets in val_dataset:
  if samples.shape != (batch_size, sequence_length, 14):
    print(samples.shape)
    print(targets.shape)

(103, 120, 14)
(103,)
(118, 120, 14)
(118,)
(206, 120, 14)
(206,)

This gave the error:

Epoch 1/10
---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
<ipython-input-146-e09ecdf9d4ec> in <cell line: 15>()
     13 ]
     14 model.compile(optimizer="rmsprop", loss="mse", metrics=["mae"])
---> 15 history = model.fit(train_dataset,
     16                     epochs=10,
     17                     validation_data=val_dataset,
Only one input size may be -1, not both 0 and 1
	 [[{{node functional_9_1/flatten_10_1/Reshape}}]] [Op:__inference_one_step_on_iterator_41264]

Although I remove the partial batches, I still get the error.
I do not get the same error when fitting the dataset with the CNN.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions