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
```





---
[Visit 
Topic](https://discuss.mxnet.apache.org/t/is-it-possible-save-some-custom-value-into-dataloader-and-load-them-with-the-relative-data-later/6611/1)
 or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.mxnet.apache.org/email/unsubscribe/acee955483976aa2c771a519a1b69c55c61d111a212e5011174bdc6abdaf8f36).

Reply via email to