An in-memory computing architecture based on a duplex two-dimensional material structure for in situ machine learning