def straight_through(fw_tensor, bw_tensor):
    'Use a tensor in forward pass while backpropagating gradient to another.\n\n    Args:\n        fw_tensor: A tensor to be used in the forward pass.\n        bw_tensor: A tensor to which gradient is backpropagated. Must have the\n            same shape and type with :attr:`fw_tensor`.\n\n    Returns:\n        A tensor of the same shape and value with :attr:`fw_tensor` but will\n        direct gradient to bw_tensor.\n    '
    return ((tf.stop_gradient(fw_tensor) + bw_tensor) - tf.stop_gradient(bw_tensor))
Use a tensor in forward pass while backpropagating gradient to another.

Args:
    fw_tensor: A tensor to be used in the forward pass.
    bw_tensor: A tensor to which gradient is backpropagated. Must have the
        same shape and type with :attr:`fw_tensor`.

Returns:
    A tensor of the same shape and value with :attr:`fw_tensor` but will
    direct gradient to bw_tensor.
def straight_through(fw_tensor, bw_tensor):
    'Use a tensor in forward pass while backpropagating gradient to another.\n\n    Args:\n        fw_tensor: A tensor to be used in the forward pass.\n        bw_tensor: A tensor to which gradient is backpropagated. Must have the\n            same shape and type with :attr:`fw_tensor`.\n\n    Returns:\n        A tensor of the same shape and value with :attr:`fw_tensor` but will\n        direct gradient to bw_tensor.\n    '
    return ((tf.stop_gradient(fw_tensor) + bw_tensor) - tf.stop_gradient(bw_tensor))