A Neural Network Subgrid Model of the Early Stages of Planet Formation