Writing mxnet.ndarray to disk in recordio format


#1

I am trying to write a simple serializer/deserializer for writing label arrays to disk. I cannot find an example for writing mxnet ndarrays to disk in recordio format which I can load back using the data iterators.

The code below will not work as record.write() function expects a char buffer. What is the best way to write such a serializer ?

import mxnet as mx

if __name__=='__main__':
    record = mx.recordio.MXRecordIO('/tmp/tmp-recordio.rec', 'w')
    for i in range(50000):
        arr = mx.ndarray.uniform(low=0, high=1, shape=(1,480,80,80))
        record.write(arr)
    record.close()