Patent attributes
Some embodiments of the invention provide a method for configuring a machine-trained (MT) network that includes multiple nodes. Each node of a set of the nodes generates an output value based on received input values and a set of configurable weights. The method propagates a set of inputs through the MT network to generate a set of outputs, with each input having a corresponding expected output. The method calculates a value of a loss function comprising (i) a first term that measures a difference between each generated output and its corresponding expected output and (ii) a second term that constrains the weights to discrete sets of allowed values and accounts for an increase in the first term due to constraining the weights to the discrete sets of values. The method uses the calculated value of the loss function to train the weights of the MT network.