Learning the Optimal Path and DNN Partition for Collaborative Edge Inference