tf.raw_ops.GRUBlockCell

Computes the GRU cell forward propagation for 1 time step.

Args x: Input to the GRU cell. h_prev: State input from the previous GRU cell. w_ru: Weight matrix for the reset and update gate. w_c: Weight matrix for the cell connection gate. b_ru: Bias vector for the reset and update gate. b_c: Bias vector for the cell connection gate.

Returns r: Output of the reset gate. u: Output of the update gate. c: Output of the cell connection gate. h: Current state of the GRU cell.

Note on notation of the variables:

Concatenation of a and b is represented by a_b Element-wise dot product of a and b is represented by ab Element-wise dot product is represented by \circ Matrix multiplication is represented by *

Biases are initialized with : b_ru - constant_initializer(1.0) b_c - constant_initializer(0.0)

This kernel op implements the following mathematical equations:

x_h_prev = [x, h_prev]

[r_bar u_bar] = x_h_prev * w_ru + b_ru

r = sigmoid(r_bar)
u = sigmoid(u_bar)

h_prevr = h_prev \circ r

x_h_prevr = [x h_prevr]

c_bar = x_h_prevr * w_c + b_c
c = tanh(c_bar)

h = (1-u) \circ c + u \circ h_prev
Args
x A Tensor. Must be one of the following types: float32.
h_prev A Tensor. Must have the same type as x.
w_ru A Tensor. Must have the same type as x.
w_c A Tensor. Must have the same type as x.
b_ru A Tensor. Must have the same type as x.
b_c A Tensor. Must have the same type as x.
name A name for the operation (optional).
Returns
A tuple of Tensor objects (r, u, c, h).
r A Tensor. Has the same type as x.
u A Tensor. Has the same type as x.
c A Tensor. Has the same type as x.
h A Tensor. Has the same type as x.

© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/python/tf/raw_ops/GRUBlockCell