import torch
n = 10
c = torch.zeros(n)%matplotlib inline
import random
import torch
from d2l import torch as d2ldef deta_iter(batch_size,feature,labels):
num_examples =len(feature)
indices = list(range(num_examples))
random.shuffle(indices)
for i in range(0,num_examples,batch_size):
batch_indices = torch.tensor(
indices[i:min(i+batch_size,num_examples)]
)
yield feature(batch_indices),labels[batch_indices]