from tensorflow.python.framework import ops

    ret.set_shape(shape)
  return ret


# NOTE(mrry): Shapes are conditionally set in the Python wrapper.
ops.RegisterShape("Variable")(common_shapes.unknown_shape)


@ops.RegisterShape("TemporaryVariable")
def _TemporaryVariableShape(op):
  """Shape function for the TemporaryVariable op."""
  shape = tensor_util.TensorShapeProtoToList(op.get_attr("shape"))
  return [tensor_shape.TensorShape(shape)]


@ops.RegisterShape("DestroyTemporaryVariable")
def _DestroyTemporaryVariableShape(op):
  """Shape function for the DestroyTemporaryVariable op."""
  return [op.inputs[0].get_shape()]


def init_variable(v, init, name="init"):
  """Initializes variable with "init".

  This op does the following:
  if init is a Tensor, v = init
  if callable(init): v = init(VariableShape(v), v.dtype)

  Args:
    v: Variable to initialize
