<commit_before>import tensorflow as tf

from ..embedding import id_sequence_to_embedding, embeddings
from ..linear import linear
from ..dropout import dropout



def char2doc(document,
             *,
             char_space_size,
             char_embedding_size,
             document_embedding_size,
             dropout_prob,
             hidden_layer_size,
             output_layer_size,
             context_vector_size):
  with tf.variable_scope("char2doc"):
    char_embeddings = embeddings(id_space_size=char_space_size,
                                 embedding_size=char_embedding_size)

    document_embedding = id_sequence_to_embedding(
        document,
        char_embeddings,
        output_embedding_size=document_embedding_size,
        context_vector_size=context_vector_size)

    hidden_layer = dropout(_activate(linear(_activate(document_embedding),
                                            hidden_layer_size)),
                           dropout_prob)
    return linear(hidden_layer, output_layer_size)


def _activate(tensor):<commit_msg>Use funcname_scope in char2doc module<commit_after>import tensorflow as tf

from ..embedding import id_sequence_to_embedding, embeddings
from ..linear import linear
from ..dropout import dropout
from ..util import funcname_scope



@funcname_scope
def char2doc(document,
             *,
             char_space_size,
             char_embedding_size,
             document_embedding_size,
             dropout_prob,
             hidden_layer_size,
             output_layer_size,
             context_vector_size):
  char_embeddings = embeddings(id_space_size=char_space_size,
                               embedding_size=char_embedding_size)

  document_embedding = id_sequence_to_embedding(
      document,
      char_embeddings,
      output_embedding_size=document_embedding_size,
      context_vector_size=context_vector_size)

  hidden_layer = dropout(_activate(linear(_activate(document_embedding),
                                          hidden_layer_size)),
                         dropout_prob)
  return linear(hidden_layer, output_layer_size)


def _activate(tensor):
{'fraction_non_alphanumeric': 0.053488372093023255, 'fraction_numerical': 0.0018604651162790699, 'mean_word_length': 2.4197138314785374, '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': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4853911', 'n_tokens_mistral': 578, 'n_tokens_neox': 565, 'n_words': 98}