Echoing signal n steps is an example of synchronized many-to-many task:
from sequential_tasks import EchoData
batch_size = 5
echo_step = 3
series_length = 20000
truncated_length = 10
data_gen = EchoData(
echo_step=echo_step,
batch_size=batch_size,
series_length=series_length,
truncated_length=truncated_length)
# Let's print first 20 timesteps of the first sequences to see the echo data:
print('(1st sequence) x = ', data_gen.raw_x[0, :20], '... ')
print('(1st sequence) y = ', data_gen.raw_y[0, :20], '... ')
# batch_size different sequences are created:
print('bax = ')
print(data_gen.raw_x[:, :20])
print('y = ')
print(data_gen.raw_y[:, :20])
print('raw_x shape:', data_gen.raw_x.shape) # shape = (batch_size, sequence_length)
print('raw_y shape:', data_gen.raw_y.shape) # shape = (batch_size, sequence_length)
# In order to use RNNs data is organized into tensors of size:
# [batch_size, truncated_sequence_length, feature_dim
i_batch = 0
print('batch x shape:', data_gen.x_batches[i_batch].shape)
print('batch y shape:', data_gen.y_batches[i_batch].shape)
print(data_gen.x_batches[i_batch])
print(data_gen.y_batches[i_batch])