@KFrank, okay, let me tell you my exact use case.
I have an encoder (fixed) that maps m bit vector, say z, to n bit (4 in this case, n > m) vector, x. This is then passed through a box, which causes random distortions, namely, the multiplicative distortion a and additive distortion b. a and b are random but the statistics of the distribution are known. The network that I am designing needs to able to get back the original m bit length vector (z) upon seeing y (y=ax+b) and a. In literature, for such a setting, it is optimal to choose an x (and hence z because there is one-one fixed mapping through the encoder) which minimizes squared norm of y-ax. I would like to implement this loss function to train the network to give out x (or the class of x), so that I meet the optimum performance. My implementation through the neural network may be a round about approach to achieve what I want, because I am still a novice.
There can be at most 2^m classes for z and therefore x. These classes are assumed to be known to the network. Its job is then to predict the class which gives the minimum loss function value.
Thank you again for replying. Please let me know if you need more clarifications.