turn LayerSpec into class agian with compare method