Lattice gauge symmetry in neural networks