Loading...
Searching...
No Matches
torch2Eigen.H
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ██╗████████╗██╗ ██╗ █████╗ ██████╗ █████╗ ███████╗██╗ ██╗
3 ██║╚══██╔══╝██║ ██║██╔══██╗██╔════╝██╔══██╗ ██╔════╝██║ ██║
4 ██║ ██║ ███████║███████║██║ ███████║█████╗█████╗ ██║ ██║
5 ██║ ██║ ██╔══██║██╔══██║██║ ██╔══██║╚════╝██╔══╝ ╚██╗ ██╔╝
6 ██║ ██║ ██║ ██║██║ ██║╚██████╗██║ ██║ ██║ ╚████╔╝
7 ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝ ╚═╝ ╚═══╝
8
9 * In real Time Highly Advanced Computational Applications for Finite Volumes
10 * Copyright (C) 2017 by the ITHACA-FV authors
11-------------------------------------------------------------------------------
12License
13 This file is part of ITHACA-FV
14 ITHACA-FV is free software: you can redistribute it and/or modify
15 it under the terms of the GNU Lesser General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18 ITHACA-FV is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU Lesser General Public License for more details.
22 You should have received a copy of the GNU Lesser General Public License
23 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
24Class
25 torch2Eigen
26Description
27 set of functions to convert Eigen object to Torch objects and viceversa
28SourceFiles
29 torch2Eigen.C
30\*---------------------------------------------------------------------------*/
31
36
37#ifndef torch2Eigen_H
38#define torch2Eigen_H
39
40#include <iostream>
41#include <torch/script.h>
42#include <torch/torch.h>
43#include <Eigen/Eigen>
44#include "ITHACAassert.H"
45
46namespace ITHACAtorch
47{
48namespace torch2Eigen
49{
59template<class type>
60torch::Tensor eigenMatrix2torchTensor(
61 Eigen::Matrix<type, Eigen::Dynamic, Eigen::Dynamic> eigenMatrix);
62
63
73template<class type>
74Eigen::Matrix<type, Eigen::Dynamic, Eigen::Dynamic> torchTensor2eigenMatrix(
75 torch::Tensor& torchTensor);
76}
77
78}
79
80#endif
Implementation of the assert function for ITHACA-FV.
Eigen::Matrix< type, Eigen::Dynamic, Eigen::Dynamic > torchTensor2eigenMatrix(torch::Tensor &torchTensor)
Convert a torch tensor to an eigen Matrix.
Definition torch2Eigen.C:55
torch::Tensor eigenMatrix2torchTensor(Eigen::Matrix< type, Eigen::Dynamic, Eigen::Dynamic > _eigenMatrix)
Convert an eigen Matrix to a torch tensor.
Definition torch2Eigen.C:39