I have a lot of data. At the entrance of the network, I submit a window the size of batch.
Batch I create in a loop.
I made the code, it works, but not very efficiently.
I have to repeat the same thing in every epoch. Inside the epoch, code also creates batch for a very long time. Are there any ideas how to optimize my code?
for epoch in range(epochs):
    for wn_start in range(0,len_batch-wn1,batch):
        wn_t = wn_t + wn1
        wn_all = []
        los_target = []
        for b_iter in range(batch):
            wn_all = wn_all + [st_s[wn_start+b_iter:wn_t+b_iter,:]]
            los_target = los_target + [st_target[wn_t-1+b_iter]]
        wn_all = torch.as_tensor(wn_all, dtype=torch.float32)
        los_target = torch.Tensor([los_l])


wn.png1923×664 8.09 KB