https://mooseframework.inl.gov
Namespaces | Functions
LibtorchUtils.h File Reference

Go to the source code of this file.

Namespaces

 LibtorchUtils
 

Functions

template<typename DataType >
void LibtorchUtils::vectorToTensor (const 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 >
torch::Tensor LibtorchUtils::vectorToTensorCopy (const std::vector< DataType > &vector, c10::IntArrayRef sizes)
 Utility function that creates an owning tensor copy of a standard vector. More...
 
template<typename DataType >
torch::Tensor LibtorchUtils::vectorToTensorView (std::vector< DataType > &vector, c10::IntArrayRef sizes)
 Utility function that creates a non-owning tensor view of a standard vector. More...
 
void LibtorchUtils::moveToLibtorchDevice (torch::Tensor &tensor, const torch::DeviceType device_type)
 Move a tensor to the configured libtorch device. More...
 
torch::Tensor LibtorchUtils::toCPUContiguous (const torch::Tensor &tensor)
 Return a detached contiguous CPU copy of a tensor. More...
 
template<typename DataType >
void LibtorchUtils::tensorToVector (torch::Tensor &tensor, std::vector< DataType > &vector)
 Utility function that converts a torch::Tensor to a standard vector. More...