(self, inputs, state, scope=None)
return self._cell(embedded, state)
Run the cell on embedded inputs.
Run the cell on embedded inputs.
Run the cell on embedded inputs .
def __call__(self, inputs, state, scope=None):
    """Run the cell on embedded inputs."""
    with vs.variable_scope(scope or "embedding_wrapper"):  # "EmbeddingWrapper"
      with ops.device("/cpu:0"):
        if self._initializer:
          initializer = self._initializer
        elif vs.get_variable_scope().initializer:
          initializer = vs.get_variable_scope().initializer
        else:
          # Default initializer for embeddings should have variance=1.
          sqrt3 = math.sqrt(3)  # Uniform(-sqrt(3), sqrt(3)) has variance=1.
          initializer = init_ops.random_uniform_initializer(-sqrt3, sqrt3)

        if type(state) is tuple:
          data_type = state[0].dtype
        else:
          data_type = state.dtype

        embedding = vs.get_variable(
            "embedding", [self._embedding_classes, self._embedding_size],
            initializer=initializer,
            dtype=data_type)
        embedded = embedding_ops.embedding_lookup(
            embedding, array_ops.reshape(inputs, [-1]))
    return self._cell(embedded, state)
def __call__ ( self , inputs , state , scope = None ) : with vs . variable_scope ( scope or "embedding_wrapper" ) : # "EmbeddingWrapper" with ops . device ( "/cpu:0" ) : if self . _initializer : initializer = self . _initializer elif vs . get_variable_scope ( ) . initializer : initializer = vs . get_variable_scope ( ) . initializer else : # Default initializer for embeddings should have variance=1. sqrt3 = math . sqrt ( 3 ) # Uniform(-sqrt(3), sqrt(3)) has variance=1. initializer = init_ops . random_uniform_initializer ( - sqrt3 , sqrt3 ) if type ( state ) is tuple : data_type = state [ 0 ] . dtype else : data_type = state . dtype embedding = vs . get_variable ( "embedding" , [ self . _embedding_classes , self . _embedding_size ] , initializer = initializer , dtype = data_type ) embedded = embedding_ops . embedding_lookup ( embedding , array_ops . reshape ( inputs , [ - 1 ] ) ) return self . _cell ( embedded , state )