Silicon Photonics for Machine Learning: Training and Inference