STT-tensorflow/tensorflow/compiler/xla/python/dlpack.h
Peter Hawkins 3f7adb0d48 [XLA:Python] Add a PyClient wrapper object around PjRtClient.
Refactoring in preparation for adding Python-specific logic to clients, but it also is more readable than inlining this kind of logic into the binding code.

PiperOrigin-RevId: 314994078
Change-Id: I3b7253d4a14ff418068e49f9bd321d85695f9c8b
2020-06-05 14:18:04 -07:00

33 lines
1.2 KiB
C++

/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#ifndef TENSORFLOW_COMPILER_XLA_PYTHON_DLPACK_H_
#define TENSORFLOW_COMPILER_XLA_PYTHON_DLPACK_H_
#include "pybind11/pybind11.h"
#include "tensorflow/compiler/xla/python/py_buffer.h"
#include "tensorflow/compiler/xla/python/py_client.h"
namespace xla {
StatusOr<pybind11::capsule> BufferToDLPackManagedTensor(PyBuffer* buffer);
StatusOr<std::unique_ptr<PyBuffer>> DLPackManagedTensorToBuffer(
const pybind11::capsule& tensor, std::shared_ptr<PyClient> client);
} // namespace xla
#endif // TENSORFLOW_COMPILER_XLA_PYTHON_DLPACK_H_