Build tensorflow dataset iterator that produce batches with special structure

Multi tool use


Build tensorflow dataset iterator that produce batches with special structure
As I mentioned in the title I need batches with special structure:
1111
5555
2222
Each digit represent feature-vector. So there are N=4
vectors of each classes {1,2,5}
(M=3
) and batch size is NxM=12
.
N=4
{1,2,5}
M=3
NxM=12
To accomplish this task I'm using Tensorflow Dataset API and tfrecords:
M
N
My concern is that I have hundreds (and maybe thousands in the feature) of classes and storing iterator for each class doesn't look good (from memory and performance perspective).
Is there a better way?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.