Regarding precision

my batch_size is 256(default),i was evaluating the model by checking its precission value,for inputs more than the batch_size i am getting good precission,but for input images less than 256 i am getting very poor precission value
my precision is calculated like below…
it will compare the prediction with the target if it matches it will result in “1”,such that it will count the number of resulted “1s” and stored in ‘correct_k’ and formula is…(correct_k/batch_size)*100

Another problem is ,for input >256 target is starting from [0,1,2…255],and predicted value has the index starting same as the target …so while comparing i am getting the good precision value…BUT for input<256 target is starting from [1,2,…256],but prediction is happening correct ,so while comparing prediction with target i am getting very less precision

@ptrblck can you please help in how target is calculated
here is the code…
“”“prec1, prec5 = accuracy(output.data, target, topk=(1, 5))
def accuracy(output, target, topk=(1,)):
“”“Computes the precision@k for the specified values of k””"
maxk = max(topk)
batch_size = target.size(0)

_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))

res = []
for k in topk:
    correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
    res.append(correct_k.mul_(100.0 / batch_size))
return res"""