import torch
# Source: https://stackoverflow.com/questions/57815001/pytorch-collate-fn-reject-sample-and-yield-another

def prune_illegal_collate(batch):
    batch = list(filter(lambda x: x is not None, batch))  # filter out all the Nones
    return torch.utils.data.dataloader.default_collate(batch)

def batch_iter(dataloader, epochs):
    for epochId in range(epochs):
        for idx, batch in enumerate(dataloader):
            yield epochId, idx, batch
27f2e1f7803bb2d28e91a1673c8f8538795c022d
<mask token>

<mask token>


def batch_iter(dataloader, epochs):
    for epochId in range(epochs):
        for idx, batch in enumerate(dataloader):
            yield epochId, idx, batch

<mask token>


def prune_illegal_collate(batch):
    batch = list(filter(lambda x: x is not None, batch))
    return torch.utils.data.dataloader.default_collate(batch)


def batch_iter(dataloader, epochs):
    for epochId in range(epochs):
        for idx, batch in enumerate(dataloader):
            yield epochId, idx, batch

import torch


def prune_illegal_collate(batch):
    batch = list(filter(lambda x: x is not None, batch))
    return torch.utils.data.dataloader.default_collate(batch)


def batch_iter(dataloader, epochs):
    for epochId in range(epochs):
        for idx, batch in enumerate(dataloader):
            yield epochId, idx, batch

import torch
# Source: https://stackoverflow.com/questions/57815001/pytorch-collate-fn-reject-sample-and-yield-another

def prune_illegal_collate(batch):
    batch = list(filter(lambda x: x is not None, batch))  # filter out all the Nones
    return torch.utils.data.dataloader.default_collate(batch)

def batch_iter(dataloader, epochs):
    for epochId in range(epochs):
        for idx, batch in enumerate(dataloader):
            yield epochId, idx, batch