IgANet
IgANets - Isogeometric Analysis Networks
Loading...
Searching...
No Matches
serialize.hpp File Reference

Serialization utility functions. More...

#include <utils/tensorarray.hpp>
#include <nlohmann/json.hpp>
#include <pugixml.hpp>
#include <torch/torch.h>

Go to the source code of this file.

Classes

struct  iganet::utils::Serializable
 Serialization prototype. More...
 

Namespaces

namespace  iganet
 
namespace  iganet::utils
 

Functions

template<typename T , std::size_t N>
torch::Tensor & iganet::utils::from_xml (const pugi::xml_document &doc, torch::Tensor &tensor, std::string tag="Matrix", int id=0, std::string label="", bool alloc=true, int index=-1)
 Converts an XML document object to a torch::Tensor object.
 
template<typename T , std::size_t N>
torch::TensorAccessor< T, N > & iganet::utils::from_xml (const pugi::xml_document &doc, torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, std::string tag="Matrix", int id=0, std::string label="", int index=-1)
 Converts an XML documentobject to a torch::TensorAccessor object.
 
template<typename T , std::size_t N, std::size_t M>
utils::TensorArray< M > & iganet::utils::from_xml (const pugi::xml_document &doc, utils::TensorArray< M > &tensors, std::string tag="Matrix", int id=0, bool alloc=true, std::string label="")
 Converts an XML document object to an std::array of torch::Tensor objects.
 
template<typename T , std::size_t N>
torch::Tensor & iganet::utils::from_xml (const pugi::xml_node &root, torch::Tensor &tensor, std::string tag="Matrix", int id=0, std::string label="", bool alloc=true, int index=-1)
 Converts an XML object to a torch::Tensor object.
 
template<typename T , std::size_t N>
torch::TensorAccessor< T, N > & iganet::utils::from_xml (const pugi::xml_node &root, torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, std::string tag="Matrix", int id=0, std::string label="", int index=-1)
 Converts an XML object to a torch::TensorAccessor object.
 
template<typename T , std::size_t N, std::size_t M>
utils::TensorArray< M > & iganet::utils::from_xml (const pugi::xml_node &root, utils::TensorArray< M > &tensors, std::string tag="Matrix", int id=0, bool alloc=true, std::string label="")
 Converts an XML object to an std::array of torch::Tensor objects.
 
template<typename T , std::size_t N>
auto iganet::utils::to_json (const torch::Tensor &tensor)
 Converts a torch::Tensor object to a JSON object.
 
template<typename T , std::size_t N>
auto iganet::utils::to_json (const torch::TensorAccessor< T, N > &accessor)
 Converts a torch::TensorAccessor object to a JSON object.
 
template<typename T , std::size_t N, std::size_t M>
auto iganet::utils::to_json (const utils::TensorArray< M > &tensors)
 Converts an std::array of torch::Tensor objects to a JSON object.
 
template<typename T , std::size_t N>
pugi::xml_node & iganet::utils::to_xml (const torch::Tensor &tensor, pugi::xml_node &root, std::string tag="Matrix", int id=0, std::string label="", int index=-1)
 Converts a torch::Tensor object to an XML object.
 
template<typename T , std::size_t N>
pugi::xml_document iganet::utils::to_xml (const torch::Tensor &tensor, std::string tag="Matrix", int id=0, std::string label="", int index=-1)
 Converts a torch::Tensor object to an XML document object.
 
template<typename T , std::size_t N>
pugi::xml_node & iganet::utils::to_xml (const torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, pugi::xml_node &root, std::string tag="Matrix", int id=0, std::string label="", int index=-1)
 Converts a torch::TensorAccessor object to an XML object.
 
template<typename T , std::size_t N>
pugi::xml_document iganet::utils::to_xml (const torch::TensorAccessor< T, N > &accessor, torch::IntArrayRef sizes, std::string tag="Matrix", int id=0, std::string label="", int index=-1)
 Converts a torch::TensorAccessor object to an XML document object.
 
template<typename T , std::size_t N, std::size_t M>
pugi::xml_node & iganet::utils::to_xml (const utils::TensorArray< M > &tensors, pugi::xml_node &root, std::string tag="Matrix", int id=0, std::string label="")
 Converts an std::array of torch::Tensor objects to an XML object.
 
template<typename T , std::size_t N, std::size_t M>
pugi::xml_document iganet::utils::to_xml (const utils::TensorArray< M > &tensors, std::string tag="Matrix", int id=0, std::string label="", int index=-1)
 Converts an std::array of torch::Tensor objects to an XML object.
 

Detailed Description

Serialization utility functions.

Author
Matthias Moller

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.