This is how i pre-processed the time-series data
test_data_size = 150000

X_train = data[:-test_data_size]
X_test = data[-test_data_size:]
print('X_train shape :{}'.format(X_train.shape))
print('X_test shape : {}'.format(X_test.shape))

#Transform and normalize X_train
scaler = MinMaxScaler(feature_range=(-1, 1))
X_train_normalized = scaler.fit_transform(X_train.reshape(-1, 1))
X_train_tensor = torch.FloatTensor(X_train_normalized).view(-1)
print('X_train_tensor shape {}'.format(X_train_tensor.shape))

# In our dataset it is convenient to use a sequence length of 30 min
# since we have data by minute send by IoT devices to the cloud
train_window = 1

#Create the sequence for the training dataset
def create_train_sequences(input_data, tw):
    seq = []
    labels = []
    L = len(input_data)
    for i in range(L-tw):
        train_seq = input_data[i:i+tw]
        train_label = input_data[i+tw:i+tw+1]
        seq.append((train_seq))
        labels.append((train_label))

    return seq, labels

train_seq, train_labels = create_train_sequences(X_train, train_window)
train_seq = torch.FloatTensor(train_seq)
train_labels = torch.FloatTensor(train_labels)
print('train_seq shape: {}'.format(train_seq.shape))
print('train_labels shape : {}'.format(train_labels.shape))
#print('train_seq shape: {}'.format(len(train_seq)))
#print('train_labels shape : {}'.format(len(train_labels)))

def create_test_sequences(input_data, tw):
    seq = []
    labels = []
    L = len(input_data)
    for i in range(L-tw):
        test_seq = input_data[i:i+tw]
        test_label = input_data[i+tw:i+tw+1]
        seq.append((test_seq))
        labels.append((test_label))
    
    return seq, labels

test_seq, test_labels = create_test_sequences(X_test, train_window)
test_seq = torch.FloatTensor(test_seq)
test_labels = torch.FloatTensor(test_labels)
print('test_seq shape: {}'.format(test_seq.shape))
print('test_labels shape: {}'.format(test_labels.shape))


X_train shape :(815943,)
X_test shape : (150000,)
X_train_tensor shape torch.Size([815943])
train_seq shape: torch.Size([815942, 1])
train_labels shape : torch.Size([815942, 1])
test_seq shape: torch.Size([149999, 1])
test_labels shape: torch.Size([149999, 1])
And this is how I federated to feed it to the LSTM network, the rest of the training code was post it above :
BATCH_SIZE = 1024
# Create pytorch tensor from X_train,X_test
train_inputs = train_seq.clone().detach().unsqueeze(-1)
train_labels = train_labels.clone().detach()

#train_inputs = train_seq.clone().detach().requires_grad_(True)
#train_labels = train_labels.clone().detach().requires_grad_(True)

#train_inputs = torch.tensor(train_seq,dtype=torch.float).tag("#seq")
#train_labels = torch.tensor(train_labels, dtype=torch.float).tag("#label")

print('train_inputs shape : {}'.format(train_inputs.shape))
print('train_labels shape : {}'.format(train_labels.shape))

test_inputs = test_seq.clone().detach().unsqueeze(-1)
test_labels = test_labels.clone().detach()

#train_inputs = test_inputs.clone().detach().requires_grad_(True)
#test_labels = test_labels.clone().detach().requires_grad_(True)

#test_inputs = torch.tensor(test_seq,dtype=torch.float).tag("#seq")
#test_labels = torch.tensor(test_labels, dtype=torch.float).tag("#label")
print('test_inputs shape : {}'.format(test_inputs.shape))
print('test_labels shape : {}'.format(test_labels.shape))

# Send the training and test data to the gatways in equal proportion.
train_idx = int(len(X_train)/2)
test_idx = int(len(X_test)/2)
gatway1_train_dataset = sy.BaseDataset(train_inputs[:train_idx], train_inputs[:train_idx]).send(gatway1)
gatway2_train_dataset = sy.BaseDataset(train_inputs[train_idx:], train_inputs[train_idx:]).send(gatway2)
gatway1_test_dataset = sy.BaseDataset(test_inputs[:test_idx], test_inputs[:test_idx]).send(gatway1)
gatway2_test_dataset = sy.BaseDataset(test_inputs[test_idx:], test_inputs[test_idx:]).send(gatway2)
print('gatway1_train_dataset : {}'.format(gatway1_train_dataset))
print('gatway2_train_dataset : {}'.format(gatway2_train_dataset))

# Create federated datasets, an extension of Pytorch TensorDataset class
federated_train_dataset = sy.FederatedDataset([gatway1_train_dataset, gatway2_train_dataset])
federated_test_dataset = sy.FederatedDataset([gatway1_test_dataset, gatway2_test_dataset])
print('federated_train_dataset : {}'.format(federated_train_dataset))
print('federated_test_dataset : {}'.format(federated_test_dataset))

# Create federated dataloaders, an extension of Pytorch DataLoader class
federated_train_loader = sy.FederatedDataLoader(federated_train_dataset, shuffle=True, batch_size=BATCH_SIZE)
federated_test_loader = sy.FederatedDataLoader(federated_test_dataset, shuffle=False, batch_size=BATCH_SIZE)
print('federated_train_loader : {}'.format(federated_train_loader))
print('federated_test_loader : {}'.format(federated_test_loader))

I printed out the last shapes for my network before the training as follow :
train_inputs shape : torch.Size([815942, 1, 1])
train_labels shape : torch.Size([815942, 1])
test_inputs shape : torch.Size([149999, 1, 1])
test_labels shape : torch.Size([149999, 1])
gatway1_train_dataset : <syft.frameworks.torch.federated.dataset.BaseDataset object at 0x159aafd10>
gatway2_train_dataset : <syft.frameworks.torch.federated.dataset.BaseDataset object at 0x15a82e350>
federated_train_dataset : FederatedDataset
    Distributed accross: gatway1, gatway2
    Number of datapoints: 815942

federated_test_dataset : FederatedDataset
    Distributed accross: gatway1, gatway2
    Number of datapoints: 149999

federated_train_loader : <syft.frameworks.torch.federated.dataloader.FederatedDataLoader object at 0x159ab02d0>
federated_test_loader : <syft.frameworks.torch.federated.dataloader.FederatedDataLoader object at 0x15a82e310>


Could anyone please tell me what is going on with this LSTM and what I am doing wrong in shaping the tensors? Much appreciated