Loading [Contrib]/a11y/accessibility-menu.js
You need to enable JavaScript to run this app. \u200E
Class ZeroCopyTensor
Class Documentation
class paddle :: ZeroCopyTensor
Represents an n-dimensional array of values. The ZeroCopyTensor is used to store the input or output of the network. Zero copy means that the tensor supports direct copy of host or device data to device, eliminating additional CPU copy. ZeroCopyTensor is only used in the AnalysisPredictor. It is obtained through PaddlePredictor::GetinputTensor() and PaddlePredictor::GetOutputTensor() interface.
Public Functions
void Reshape ( const std :: vector < int > & shape )
Reset the shape of the tensor. Generally it’s only used for the input tensor. Reshape must be called before calling mutable_data() or copy_from_cpu()
Parameters
shape – The shape to set.
template < typename T > T * mutable_data ( PaddlePlace place )
Get the memory pointer in CPU or GPU with specific data type. Please Reshape the tensor first before call this. It’s usually used to get input data pointer.
Parameters
place – The place of the tensor.
template < typename T > T * data ( PaddlePlace * place , int * size ) const
Get the memory pointer directly. It’s usually used to get the output data pointer.
Parameters
Returns
The tensor data buffer pointer.
template < typename T > void copy_from_cpu ( const T * data )
Copy the host memory to tensor data. It’s usually used to set the input tensor data.
Parameters
data – The pointer of the data, from which the tensor will copy.
template < typename T > void copy_to_cpu ( T * data )
Copy the tensor data to the host memory. It’s usually used to get the output tensor data.
Parameters
data – [out] The tensor will copy the data to the address.
std :: vector < int > shape ( ) const
Return the shape of the Tensor.
void SetLoD ( const std :: vector < std :: vector < size_t > > & x )
Set lod info of the tensor. More about LOD can be seen here: https://www.paddlepaddle.org.cn/documentation/docs/zh/beginners_guide/basic_concept/lod_tensor.html#lodtensor .
Parameters
x – the lod info.
std :: vector < std :: vector < size_t > > lod ( ) const
Return the lod info of the tensor.
inline const std :: string & name ( ) const
Return the name of the tensor.
inline void SetPlace ( PaddlePlace place , int device = - 1 )
PaddleDType type ( ) const
Return the data type of the tensor. It’s usually used to get the output tensor data type.
Returns
The data type of the tensor.
Protected Functions
inline explicit ZeroCopyTensor ( void * scope )
inline void SetName ( const std :: string & name )
void * FindTensor ( ) const
Edit on Github 文档反馈
Class ZeroCopyTensor — Paddle-Inference documentation
Paddle-Inference
Class ZeroCopyTensor
Class Documentation
class paddle :: ZeroCopyTensor
Represents an n-dimensional array of values. The ZeroCopyTensor is used to store the input or output of the network. Zero copy means that the tensor supports direct copy of host or device data to device, eliminating additional CPU copy. ZeroCopyTensor is only used in the AnalysisPredictor. It is obtained through PaddlePredictor::GetinputTensor() and PaddlePredictor::GetOutputTensor() interface.
Public Functions
void Reshape ( const std :: vector < int > & shape )
Reset the shape of the tensor. Generally it’s only used for the input tensor. Reshape must be called before calling mutable_data() or copy_from_cpu()
Parameters
shape – The shape to set.
template < typename T > T * mutable_data ( PaddlePlace place )
Get the memory pointer in CPU or GPU with specific data type. Please Reshape the tensor first before call this. It’s usually used to get input data pointer.
Parameters
place – The place of the tensor.
template < typename T > T * data ( PaddlePlace * place , int * size ) const
Get the memory pointer directly. It’s usually used to get the output data pointer.
Parameters
Returns
The tensor data buffer pointer.
template < typename T > void copy_from_cpu ( const T * data )
Copy the host memory to tensor data. It’s usually used to set the input tensor data.
Parameters
data – The pointer of the data, from which the tensor will copy.
template < typename T > void copy_to_cpu ( T * data )
Copy the tensor data to the host memory. It’s usually used to get the output tensor data.
Parameters
data – [out] The tensor will copy the data to the address.
std :: vector < int > shape ( ) const
Return the shape of the Tensor.
void SetLoD ( const std :: vector < std :: vector < size_t > > & x )
Set lod info of the tensor. More about LOD can be seen here: https://www.paddlepaddle.org.cn/documentation/docs/zh/beginners_guide/basic_concept/lod_tensor.html#lodtensor .
Parameters
x – the lod info.
std :: vector < std :: vector < size_t > > lod ( ) const
Return the lod info of the tensor.
inline const std :: string & name ( ) const
Return the name of the tensor.
inline void SetPlace ( PaddlePlace place , int device = - 1 )
PaddleDType type ( ) const
Return the data type of the tensor. It’s usually used to get the output tensor data type.
Returns
The data type of the tensor.
Protected Functions
inline explicit ZeroCopyTensor ( void * scope )
inline void SetName ( const std :: string & name )
void * FindTensor ( ) const