<commit_before>"""Provides interface for activation-functions. Arranged in alphanumeric order."""

import tensorflow as tf


def crelu(input_):
    """
    Applies the concatenated rectified-linear-unit (CReLU) on the input, element-wise.

    # Parameters
        input_ (tensor): The tensor to be CReLU'd.
    # Returns
        The resulting tensor.
    """
    return tf.nn.crelu(input_)


def elu(input_):
    """
    Applies the exponential-linear-unit (ELU) on the input, element-wise.

    # Parameters
        input_ (tensor): The tensor to be ELU'd.
    # Returns
        The resulting tensor.
    """
    return tf.nn.elu(input_)


def relu(input_):
    """
    Applies rectified-linear-unit (ReLU) on the input, element-wise.

    # Parameters
        input_ (tensor): The tensor to be ReLU'd.
    # Returns
        The resulting tensor.
    """
    return tf.nn.relu(input_)
<commit_msg>Implemented PReLU with option for "looks-linear" init. Resnet be damned!<commit_after>"""Provides interface for activation-functions. Arranged in alphanumeric order."""

import tensorflow as tf


def crelu(input_):
    """
    Applies the concatenated rectified-linear-unit (CReLU) on the input, element-wise.

    # Parameters
        input_ (tensor): The tensor to be CReLU'd.
    # Returns
        The resulting tensor.
    """
    return tf.nn.crelu(input_)


def elu(input_):
    """
    Applies the exponential-linear-unit (ELU) on the input, element-wise.

    # Parameters
        input_ (tensor): The tensor to be ELU'd.
    # Returns
        The resulting tensor.
    """
    return tf.nn.elu(input_)


def prelu(input_, looks_linear=False):
    """
    Applies the parametric linear-unit (PReLU) on the input, element-wise.

    # Parameters
        input_ (tensor): The tensor to be PReLU'd.
        looks_linear (bool): Whether `alpha` is initialized to 1 or not.
                             See https://arxiv.org/pdf/1702.08591.pdf for details.
    # Returns
        The resulting tensor.
    """
    if looks_linear:
        alpha = tf.Variable(tf.constant(1, dtype=tf.float32, shape=input_.shape.as_list()[-1]))
    else:
        alpha = tf.Variable(tf.constant(0, dtype=tf.float32, shape=input_.shape.as_list()[-1]))
    return tf.maximum(0.0, input_) + alpha * tf.minimum(0.0, input_)


def relu(input_):
    """
    Applies rectified-linear-unit (ReLU) on the input, element-wise.

    # Parameters
        input_ (tensor): The tensor to be ReLU'd.
    # Returns
        The resulting tensor.
    """
    return tf.nn.relu(input_)

{'fraction_non_alphanumeric': 0.11333333333333333, 'fraction_numerical': 0.008627450980392156, 'mean_word_length': 2.567832167832168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5687008', 'n_tokens_mistral': 832, 'n_tokens_neox': 787, 'n_words': 232}