Brain-inspired nanophotonic spike-based devices for neuromorphic light-emitting and sensing AI applications