  Symmetries such as gauge invariance and anyonic symmetry play a crucial role
in quantum many-body physics. We develop a general approach to constructing
gauge invariant or anyonic symmetric autoregressive neural network quantum
states, including a wide range of architectures such as Transformer and
recurrent neural network (RNN), for quantum lattice models. These networks can
be efficiently sampled and explicitly obey gauge symmetries or anyonic
constraint. We prove that our methods can provide exact representation for the
ground and excited states of the 2D and 3D toric codes, and the X-cube fracton
model. We variationally optimize our symmetry incorporated autoregressive
neural networks for ground states as well as real-time dynamics for a variety
of models. We simulate the dynamics and the ground states of the quantum link
model of $\text{U(1)}$ lattice gauge theory, obtain the phase diagram for the
2D $\mathbb{Z}_2$ gauge theory, determine the phase transition and the central
charge of the $\text{SU(2)}_3$ anyonic chain, and also compute the ground state
energy of the SU(2) invariant Heisenberg spin chain. Our approach provides
powerful tools for exploring condensed matter physics, high energy physics and
quantum information science.
