MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / call

Method call

tensorflow/contrib/rnn/python/ops/rnn_cell.py:1674–1713  ·  view source on GitHub ↗

Run one step of UGRNN. Args: inputs: input Tensor, 2D, batch x input size. state: state Tensor, 2D, batch x num units. Returns: new_output: batch x num units, Tensor representing the output of the UGRNN after reading `inputs` when previous state was `state`. Ident

(self, inputs, state)

Source from the content-addressed store, hash-verified

1672 return self._num_units
1673
1674 def call(self, inputs, state):
1675 """Run one step of UGRNN.
1676
1677 Args:
1678 inputs: input Tensor, 2D, batch x input size.
1679 state: state Tensor, 2D, batch x num units.
1680
1681 Returns:
1682 new_output: batch x num units, Tensor representing the output of the UGRNN
1683 after reading `inputs` when previous state was `state`. Identical to
1684 `new_state`.
1685 new_state: batch x num units, Tensor representing the state of the UGRNN
1686 after reading `inputs` when previous state was `state`.
1687
1688 Raises:
1689 ValueError: If input size cannot be inferred from inputs via
1690 static shape inference.
1691 """
1692 sigmoid = math_ops.sigmoid
1693
1694 input_size = inputs.get_shape().with_rank(2).dims[1]
1695 if input_size.value is None:
1696 raise ValueError("Could not infer input size from inputs.get_shape()[-1]")
1697
1698 with vs.variable_scope(
1699 vs.get_variable_scope(), initializer=self._initializer):
1700 cell_inputs = array_ops.concat([inputs, state], 1)
1701 if self._linear is None:
1702 self._linear = _Linear(cell_inputs, 2 * self._num_units, True)
1703 rnn_matrix = self._linear(cell_inputs)
1704
1705 [g_act, c_act] = array_ops.split(
1706 axis=1, num_or_size_splits=2, value=rnn_matrix)
1707
1708 c = self._activation(c_act)
1709 g = sigmoid(g_act + self._forget_bias)
1710 new_state = g * state + (1.0 - g) * c
1711 new_output = new_state
1712
1713 return new_output, new_state
1714
1715
1716class IntersectionRNNCell(rnn_cell_impl.RNNCell):

Callers

nothing calls this directly

Calls 8

_LinearClass · 0.85
with_rankMethod · 0.80
variable_scopeMethod · 0.80
sigmoidClass · 0.50
get_shapeMethod · 0.45
concatMethod · 0.45
_linearMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected