Machine-learning-assisted environment-adaptive thermal metamaterials