<commit_before>import functools
import tensorflow as tf

from .util import funcname_scope, static_rank, static_shape
from .variable import variable
from .assertion import is_natural_num, is_natural_num_sequence
from .summary import image_summary



@funcname_scope
def multi_conv_and_pool(x,
                        *,
                        nums_of_channels,
                        conv_kernel_shape,
                        pool_kernel_shape):
  assert is_natural_num_sequence(nums_of_channels)
  assert _is_kernel_shape(conv_kernel_shape)
  assert _is_kernel_shape(pool_kernel_shape)

  def layer(x, num_of_channels):
    return max_pool(tf.tanh(conv2d(x, conv_kernel_shape, num_of_channels)),
                    kernel_shape=pool_kernel_shape)

  return functools.reduce(layer, nums_of_channels, x)


@funcname_scope
def multi_conv(x,
               *,
               nums_of_channels,
               kernel_shape):
  assert is_natural_num_sequence(nums_of_channels)
  assert _is_kernel_shape(kernel_shape)

  def layer(x, num_of_channels):
    return tf.tanh(conv2d(x, kernel_shape, num_of_channels))

  return functools.reduce(layer, nums_of_channels, x)
<commit_msg>Add funcname_scopes of internal layers of conv networks<commit_after>import functools
import tensorflow as tf

from .util import funcname_scope, static_rank, static_shape
from .variable import variable
from .assertion import is_natural_num, is_natural_num_sequence
from .summary import image_summary



@funcname_scope
def multi_conv_and_pool(x,
                        *,
                        nums_of_channels,
                        conv_kernel_shape,
                        pool_kernel_shape):
  assert is_natural_num_sequence(nums_of_channels)
  assert _is_kernel_shape(conv_kernel_shape)
  assert _is_kernel_shape(pool_kernel_shape)

  @funcname_scope
  def layer(x, num_of_channels):
    return max_pool(tf.tanh(conv2d(x, conv_kernel_shape, num_of_channels)),
                    kernel_shape=pool_kernel_shape)

  return functools.reduce(layer, nums_of_channels, x)


@funcname_scope
def multi_conv(x,
               *,
               nums_of_channels,
               kernel_shape):
  assert is_natural_num_sequence(nums_of_channels)
  assert _is_kernel_shape(kernel_shape)

  @funcname_scope
  def layer(x, num_of_channels):
    return tf.tanh(conv2d(x, kernel_shape, num_of_channels))

  return functools.reduce(layer, nums_of_channels, x)

{'fraction_non_alphanumeric': 0.060905349794238686, 'fraction_numerical': 0.0016460905349794238, 'mean_word_length': 3.295053003533569, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4683264', 'n_tokens_mistral': 778, 'n_tokens_neox': 753, 'n_words': 147}