Functions as the TensorBase constructor, which is used to create TensorBase objects. Different constructors can be selected based on the passed parameters.
If an exception indicating that the constructor fails to be executed due to memory exhaustion occurs, do not call subsequent member functions.
Prototype 1:
1 | TensorBase::TensorBase(); |
Prototype 2:
1 | TensorBase::TensorBase(const MemoryData &memoryData, const bool &isBorrowed, const std::vector<uint32_t> &shape, const TensorDataType &type); |
Prototype 3:
TensorBase::TensorBase(const std::vector<uint32_t> &shape, const TensorDataType &type, const MemoryData::MemoryType &bufferType, const int32_t &deviceId);
Prototype 4:
1 | TensorBase::TensorBase(const std::vector<uint32_t> &shape, const TensorDataType &type, const int32_t &deviceId); |
Prototype 5:
1 | TensorBase::TensorBase(const std::vector<uint32_t> &shape, const TensorDataType &type); |
Prototype 6:
1 | TensorBase::TensorBase(const std::vector<uint32_t> &shape); |
Prototype 7:
1 | TensorBase::TensorBase(const TensorBase& tensor) = default; |
Parameter |
Input/Output |
Description |
|---|---|---|
memoryData |
Input |
Memory management structure, a parameter used to construct the TensorBase object. For details, see MemoryData. |
isBorrowed |
Input |
Whether the input memory data needs to be proactively destroyed by the tensor.
|
shape |
Input |
Tensor shape, a parameter used to construct the TensorBase object. |
type |
Input |
Tensor data type, a parameter used to construct the TensorBase object. For details, see the enumerations of TensorDataType. |
bufferType |
Input |
Memory type of the tensor data, a parameter used to construct the TensorBase object. |
deviceId |
Input |
Device ID of the int type, a parameter used to construct the TensorBase object. |
tensor |
Input |
TensorBase object, a parameter used to construct the TensorBase object. |