'Returns the non-linearity function pointer for the given string code.
For forwards compatibility, allows the full names for stand-alone
non-linearities, as well as the single-letter names used in ops like C,F.
Args:
code: String code representing a non-linearity function.
Returns:
non-linearity function represented by the code.'

def _NonLinearity(self, code):

    if (code in ['s', 'Sig']):
        return tf.sigmoid
    elif (code in ['t', 'Tanh']):
        return tf.tanh
    elif (code in ['r', 'Relu']):
        return tf.nn.relu
    elif (code in ['m', 'Smax']):
        return tf.nn.softmax
    return None
