<commit_before>"""
model.py
"""

import tensorflow as tf
from layers import conv_module
import tensorflow as tf

#####################################################################
##########################     MODEL     ############################
#####################################################################

def flood_filling_network(inp, num_modules):
    """Flood filling network model.

    Args:
        inp: 5D Tensor (batch_size, depth, width, height, channels)
            the input tensor
        num_modules: int
            the number of convolutional modules to use (> 2)
    Returns:
        out: 5D Tensor (batch_size, depth, width, height, channels)
            the output tensor
    """
    assert(num_modules > 2, "num_modules should be greater than 2")
    #Compute first convolution with inp channel = 1
    inp = conv_module(inp, 1, 32)
    for _ in range(num_modules - 2):
        inp = conv_module(inp, 32, 32)
    out = conv_module(inp, 32, 1)
    return out

#####################################################################
#########################     HELPERS     ###########################
#####################################################################

def conv_module(inp, channel_in, channel_out):
    """Implements a convolutional module as outlined in the paper.
    That is: two 3D convolutions, with an relu activation on the first
    one and an relu activation over the sum of the orginal input and
    the output of the second convolution.

    Args:
        inp: 5D Tensor (batch_size, depth, width, height, channels)
            the input data
        channel_in: int
            the number of input channels
        channel_out: int<commit_msg>remove comment headers<commit_after>"""
model.py
"""

import tensorflow as tf

def flood_filling_network(inp, num_modules):
    """Flood filling network model.

    Args:
        inp: 5D Tensor (batch_size, depth, width, height, channels)
            the input tensor
        num_modules: int
            the number of convolutional modules to use (> 2)
    Returns:
        out: 5D Tensor (batch_size, depth, width, height, channels)
            the output tensor
    """
    assert(num_modules > 2, "num_modules should be greater than 2")
    #Compute first convolution with inp channel = 1
    inp = conv_module(inp, 1, 32)
    for _ in range(num_modules - 2):
        inp = conv_module(inp, 32, 32)
    out = conv_module(inp, 32, 1)
    return out

def conv_module(inp, channel_in, channel_out):
    """Implements a convolutional module as outlined in the paper.
    That is: two 3D convolutions, with an relu activation on the first
    one and an relu activation over the sum of the orginal input and
    the output of the second convolution.

    Args:
        inp: 5D Tensor (batch_size, depth, width, height, channels)
            the input data
        channel_in: int
            the number of input channels
        channel_out: int
{'fraction_non_alphanumeric': 0.19012178619756429, 'fraction_numerical': 0.012855209742895805, 'mean_word_length': 3.112656467315716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6728576', 'n_tokens_mistral': 836, 'n_tokens_neox': 766, 'n_words': 301}