Could also validate `dim` and `layers`