Triplet data loader for few-shot learning

Hello everyone, how can I implement a triplet data loader to map K-way N-shot classification for triplet network training?
I know one thing that anchor is selected from query set while positive and negative are selected from support set. the question is how?
Is there any sample code in PyTorch?

Any help would be really appreciated.