Is it possible save some custom value into dataloader and load them with the relative data later?

I tried to calculate the ‘weight’ of data

for example, how to save the current loss and read it in the next epoch?:

import os
from mxnet import nd
from mxnet.io import ImageRecordIter

rec_path = os.path.expanduser('~/.mxnet/datasets/imagenet/rec/')
train_data = ImageRecordIter(
    path_imgrec = os.path.join(rec_path, 'train.rec'),
    path_imgidx = os.path.join(rec_path, 'train.idx'),
    data_shape  = (3, 224, 224),
    batch_size  = 32,
    shuffle     = True
)
net=my_net()
net.initialize()
...
#how to initialize ImageRecordIter such that it will generate 3 rather than 2 element: data,label,custom_data
while training:
  for data,label,custom_data in ImageRecordIter:
    with ag.record():
      y=net(data.as_in_context(ctx))
      loss=loss_fn(y,label.as_in_context(ctx))*(custom_data+1)
    loss.backward()
    #how to save custom_data?
    #e.g., if I want save current loss and read it in the next iteration