Electronic synapses made of layered two-dimensional materials