@oneflow_export('tensor_to_tensor_buffer')
@stable_api
def tensor_to_tensor_buffer(x: oneflow._oneflow_internal.BlobDesc, instance_dims: int, name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc:
    "This operator converts the Blob's type from Tensor to TensorBuffer.\n\n    Refer to `Concept Explanation <https://docs.oneflow.org/basics_topics/concept_explanation.html#3tensorbuffer-tensorlist>`_\n    for more about TensorBuffer.\n\n\n    Args:\n        x (oneflow._oneflow_internal.BlobDesc): Input `Blob`.\n        instance_dims (int): The dimensions of dynamic tensor instance.\n        name (Optional[str], optional): The name for the operation. Defaults to None.\n\n    Returns:\n        oneflow._oneflow_internal.BlobDesc: The result Blob.\n\n    For example:\n\n    .. code-block:: python\n\n        import oneflow.compatible.single_client as flow\n        import numpy as np\n        import oneflow.compatible.single_client.typing as tp\n\n\n        @flow.global_function()\n        def tensor_buffer_to_tensor_Job(x: tp.Numpy.Placeholder(shape=(4, 16, 64, 64), dtype=flow.float32),\n        ) -> tp.Numpy:\n            x = flow.tensor_to_tensor_buffer(x,\n                                            instance_dims=2)\n            return flow.tensor_buffer_to_tensor(x,\n                                                instance_shape=(64, 64),\n                                                dtype=flow.float)\n\n        x = np.random.randn(4, 16, 64, 64).astype(np.float32)\n        out = tensor_buffer_to_tensor_Job(x)\n\n        # out.shape (4, 16, 64, 64)\n\n    "
    if (name is None):
        name = id_util.UniqueStr('TensorToTensorBuffer_')
    return flow.user_op_builder(name).Op('tensor_to_tensor_buffer').Input('in', [x]).Output('out').Attr('instance_dims', instance_dims).Build().InferAndTryRun().RemoteBlobList()[0]
This operator converts the Blob's type from Tensor to TensorBuffer.

Refer to `Concept Explanation <https://docs.oneflow.org/basics_topics/concept_explanation.html#3tensorbuffer-tensorlist>`_
for more about TensorBuffer.


Args:
    x (oneflow._oneflow_internal.BlobDesc): Input `Blob`.
    instance_dims (int): The dimensions of dynamic tensor instance.
    name (Optional[str], optional): The name for the operation. Defaults to None.

Returns:
    oneflow._oneflow_internal.BlobDesc: The result Blob.

For example:

.. code-block:: python

    import oneflow.compatible.single_client as flow
    import numpy as np
    import oneflow.compatible.single_client.typing as tp


    @flow.global_function()
    def tensor_buffer_to_tensor_Job(x: tp.Numpy.Placeholder(shape=(4, 16, 64, 64), dtype=flow.float32),
    ) -> tp.Numpy:
        x = flow.tensor_to_tensor_buffer(x,
                                        instance_dims=2)
        return flow.tensor_buffer_to_tensor(x,
                                            instance_shape=(64, 64),
                                            dtype=flow.float)

    x = np.random.randn(4, 16, 64, 64).astype(np.float32)
    out = tensor_buffer_to_tensor_Job(x)

    # out.shape (4, 16, 64, 64)
@oneflow_export('tensor_to_tensor_buffer')
@stable_api
def tensor_to_tensor_buffer(x: oneflow._oneflow_internal.BlobDesc, instance_dims: int, name: Optional[str]=None) -> oneflow._oneflow_internal.BlobDesc:
    "This operator converts the Blob's type from Tensor to TensorBuffer.\n\n    Refer to `Concept Explanation <https://docs.oneflow.org/basics_topics/concept_explanation.html#3tensorbuffer-tensorlist>`_\n    for more about TensorBuffer.\n\n\n    Args:\n        x (oneflow._oneflow_internal.BlobDesc): Input `Blob`.\n        instance_dims (int): The dimensions of dynamic tensor instance.\n        name (Optional[str], optional): The name for the operation. Defaults to None.\n\n    Returns:\n        oneflow._oneflow_internal.BlobDesc: The result Blob.\n\n    For example:\n\n    .. code-block:: python\n\n        import oneflow.compatible.single_client as flow\n        import numpy as np\n        import oneflow.compatible.single_client.typing as tp\n\n\n        @flow.global_function()\n        def tensor_buffer_to_tensor_Job(x: tp.Numpy.Placeholder(shape=(4, 16, 64, 64), dtype=flow.float32),\n        ) -> tp.Numpy:\n            x = flow.tensor_to_tensor_buffer(x,\n                                            instance_dims=2)\n            return flow.tensor_buffer_to_tensor(x,\n                                                instance_shape=(64, 64),\n                                                dtype=flow.float)\n\n        x = np.random.randn(4, 16, 64, 64).astype(np.float32)\n        out = tensor_buffer_to_tensor_Job(x)\n\n        # out.shape (4, 16, 64, 64)\n\n    "
    if (name is None):
        name = id_util.UniqueStr('TensorToTensorBuffer_')
    return flow.user_op_builder(name).Op('tensor_to_tensor_buffer').Input('in', [x]).Output('out').Attr('instance_dims', instance_dims).Build().InferAndTryRun().RemoteBlobList()[0]