Functions | |
template<typename DataType > | |
void | vectorToTensor (std::vector< DataType > &vector, torch::Tensor &tensor, const bool detach=false) |
Utility function that converts a standard vector to a torch::Tensor . More... | |
template<typename DataType > | |
void | tensorToVector (torch::Tensor &tensor, std::vector< DataType > &vector) |
Utility function that converts a torch::Tensor to a standard vector. More... | |
template void | vectorToTensor< Real > (std::vector< Real > &vector, torch::Tensor &tensor, const bool detach) |
template void | tensorToVector< Real > (torch::Tensor &tensor, std::vector< Real > &vector) |
void LibtorchUtils::tensorToVector | ( | torch::Tensor & | tensor, |
std::vector< DataType > & | vector | ||
) |
Utility function that converts a torch::Tensor
to a standard vector.
DataType | The type of data (float,double, etc.) which the vector is filled with |
tensor | The tensor which needs to be converted |
vector | The output vector |
Definition at line 44 of file LibtorchUtils.C.
template void LibtorchUtils::tensorToVector< Real > | ( | torch::Tensor & | tensor, |
std::vector< Real > & | vector | ||
) |
void LibtorchUtils::vectorToTensor | ( | std::vector< DataType > & | vector, |
torch::Tensor & | tensor, | ||
const bool | detach = false |
||
) |
Utility function that converts a standard vector to a torch::Tensor
.
DataType | The type of data (float,double, etc.) which the vector is filled with |
vector | The vector that needs to be converted |
tensor | The output tensor |
detach | If the gradient information needs to be detached during the conversion |
Definition at line 19 of file LibtorchUtils.C.
Referenced by LibtorchNeuralNetControl::prepareInputTensor().
template void LibtorchUtils::vectorToTensor< Real > | ( | std::vector< Real > & | vector, |
torch::Tensor & | tensor, | ||
const bool | detach | ||
) |