Optical computing has become an important way to achieve low power consumption and high computation speed. Optical neural network (ONN) is one of the key branches of optical computing due to its wide range of applications. However, the integrated ONN schemes proposed in previous works have some disadvantages, such as fixed network structure, complex matrix-vector multiplication (MVM) unit, and few all-optical nonlinear activation function (NAF) methods. Moreover, for the most compact MVM schemes based on wavelength division multiplexing (WDM), it is infeasible to employ intrinsic nonlinear effects to implement NAF, which brings frequent O-E-O conversion in ONN chips. Besides, it is also hard to realize a reconfigurable ONN with coherent MVMs, while it is much easier to implement in WDM schemes. We propose for the first time an all-optical silicon-based ONN chip based on WDM by adopting a new adjustment mechanism: optical gradient force (OGF). The proposed scheme is reconfigurable with tunable layers, variable neurons per layer, and adjustable NAF curves. In the task of classification of the MNIST dataset, our chip can realize an accuracy of 85.13% with 4 full-connected layers and only 50 neurons in total. In addition, we analyze the influence of the OGF-based NAF under fabrication errors and propose a calibration method. Compared to the previous works, our scheme has the two-fold advantages of compactness and reconfiguration, and it paves the way for the all-optical ONN based on WDM and opens the path to unblocking the bottleneck of integrated large-dimension ONNs.