In this paper, we propose a novel unsupervised algorithm for automatically segmenting a 3D shape or co-segmenting a set of 3D shapes of the same family by using deep learning. Firstly, our approach decomposes each 3D shape into primitive patches to generate an over-segmentation. Secondly, high-level features are learned from the low-level ones for each patch by using the deep learning technique in an unsupervised way. Finally, the segmentation and co-segmentation results for each 3D shape are obtained by clustering the patches in the high-level feature space. The experimental results on Princeton segmentation benchmark and COSEG dataset demonstrate the superior performance of the proposed method in comparison to the state-of-the-art methods.