SLC$^2$-SLAM: Semantic-guided Loop Closure using Shared Latent Code for NeRF SLAM