Loading...
Searching...
No Matches
torchUTILITIES.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-------------------------------------------------------------------------------
12
13 License
14 This file is part of ITHACA-FV
15
16 ITHACA-FV is free software: you can redistribute it and/or modify
17 it under the terms of the GNU Lesser General Public License as published by
18 the Free Software Foundation, either version 3 of the License, or
19 (at your option) any later version.
20
21 ITHACA-FV is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU Lesser General Public License for more details.
25
26 You should have received a copy of the GNU Lesser General Public License
27 along with ITHACA-FV. If not, see <http://www.gnu.org/licenses/>.
28
29\*---------------------------------------------------------------------------*/
30
34
35#ifndef torchUTILITIES_H
36#define torchUTILITIES_H
37
38#include <iostream>
39#include <torch/script.h>
40#include <torch/torch.h>
41#include "ITHACAassert.H"
42#include "cnpy.H"
43
44namespace ITHACAtorch
45{
46torch::Tensor removeConstValues(torch::Tensor input, std::vector<int>& indices,
47 std::vector<double>& constValues);
48bool isConst(torch::Tensor& tTensor);
49
50void save(const torch::Tensor& tensor, const std::string fname);
51
52torch::Tensor load(const std::string fname);
53}
54
55#endif
Implementation of the assert function for ITHACA-FV.
torch::Tensor load(const std::string fname)
torch::Tensor removeConstValues(torch::Tensor input, std::vector< int > &indices, std::vector< double > &constValues)
bool isConst(torch::Tensor &tTensor)
void save(const torch::Tensor &torchTensor, const std::string fname)