Converted RBM to use layers