https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Namespaces | Functions
LibtorchUtils.C File Reference

Go to the source code of this file.

Namespaces

namespace  LibtorchUtils
 

Functions

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