tensor Class Reference
|
Ratpac-two
|
cppflow::tensor Class Reference
A TensorFlow eager tensor wrapper. More...
#include <tensor.h>
Public Member Functions | |
| template<typename T > | |
| tensor (const std::vector< T > &values, const std::vector< int64_t > &shape) | |
| template<typename T > | |
| tensor (const std::initializer_list< T > &values) | |
| template<typename T > | |
| tensor (const T &value) | |
| tensor (const tensor &tensor)=default | |
| tensor (tensor &&tensor)=default | |
| tensor (TFE_TensorHandle *handle) | |
| tensor (TF_Tensor *t) | |
| tensor & | operator= (const tensor &other)=default |
| tensor & | operator= (tensor &&other)=default |
| tensor | shape () const |
| std::string | device (bool on_memory=false) const |
| datatype | dtype () const |
| template<typename T > | |
| std::vector< T > | get_data () const |
| std::shared_ptr< TFE_TensorHandle > | get_eager_handle () const |
| std::shared_ptr< TF_Tensor > | get_tensor () const |
| template<> | |
| tensor (const std::string &value) | |
Public Attributes | |
| std::shared_ptr< TFE_TensorHandle > | tfe_handle |
Detailed Description
A TensorFlow eager tensor wrapper.
Constructor & Destructor Documentation
◆ tensor() [1/3]
template<typename T >
| cppflow::tensor::tensor | ( | const std::vector< T > & | values, |
| const std::vector< int64_t > & | shape | ||
| ) |
Creates a tensor with the given values and specified shape
- Template Parameters
-
T A type that can be convertible into a tensor
- Parameters
-
values The values to be converted (in a flattened version) shape The shape of the converted tensor
◆ tensor() [2/3]
template<typename T >
| cppflow::tensor::tensor | ( | const std::initializer_list< T > & | values | ) |
Creates a flat tensor with the given values
- Template Parameters
-
T A type that can be convertible into a tensor
- Parameters
-
values The values to be converted
◆ tensor() [3/3]
template<typename T >
| cppflow::tensor::tensor | ( | const T & | value | ) |
Creates a tensor with the given value
- Template Parameters
-
T A type that can be convertible into a tensor
- Parameters
-
value The value to be converted
Member Function Documentation
◆ device()
|
inline |
- Parameters
-
on_memory If false, the function will return the name of the device that produced the tensor. If true, the function will return the name of the device in whose memory the tensor resides
- Returns
- Returns the name of the device of the tensor
◆ dtype()
|
inline |
- Returns
- The tensor datatype
◆ get_data()
template<typename T >
| std::vector< T > cppflow::tensor::get_data |
Converts the tensor into a C++ vector
- Template Parameters
-
T The c++ type (must be equivalent to the tensor type)
- Returns
- A vector representing the flat tensor
◆ shape()
|
inline |
- Returns
- Shape of the tensor
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/ratpac/checkouts/latest/src/external/cppflow/include/cppflow/tensor.h
Generated by