Haven’t tried it but this seems relevant:
see LinearComparator
LinearComparator
Thread discussing results: What does the encoder actually learn? 🤔