Efficient machine-learning representations of a surface code with boundaries, defects, domain walls, and twists | Synapse