**5. Conclusions**

We propose a deep learning clustering technique within GMsFEM to solve flows in heterogeneous media. The main idea is to cluster the uncertainty space such that we can reduce the number of multiscale basis functions for each coarse block across the uncertainty space. We propose the adversary loss motivated by the perceptual loss in the computer vision task. We use convolutional neural networks combined with some techniques in adversary neural networks, where the loss function is composed of several parts that includes terms related to clusters and reconstruction of basis functions. We present numerical results for channelized permeability fields in the examples of flows in porous media. In future, we would like to study the relation between convolutional layers and quantities related to multiscale basis functions. In addition, we are going to study the application of our method in the area of multiscale social network and other studies like extreme value prediction.

**Author Contributions:** All authors have contributed to methodology and validation. Simulations are performed by Z.Z. All authors have read and agreed to the published version of the manuscript.

**Funding:** Eric Chung's work is partially supported by the Hong Kong RGC General Research Fund (Project numbers 14304719 and 14302018) and the CUHK Faculty of Science Direct Grant 2018-19. Y.E. would like to thank the partial support from NSF 1620318 and NSF Tripod 1934904. Y.E. would also like to acknowledge the support of Mega-grant of the Russian Federation Government (N 14.Y26.31.0013).

**Conflicts of Interest:** The authors declare no conflict of interest.
