NEML2 1.4.0
Loading...
Searching...
No Matches
types.h
1// Copyright 2024, UChicago Argonne, LLC
2// All Rights Reserved
3// Software Name: NEML2 -- the New Engineering material Model Library, version 2
4// By: Argonne National Laboratory
5// OPEN SOURCE LICENSE (MIT)
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in
15// all copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23// THE SOFTWARE.
24
25#pragma once
26
27#include <torch/types.h>
28
29namespace neml2
30{
31using Real = double;
32using Integer = int;
33using Size = int64_t;
34using TensorShape = torch::SmallVector<Size>;
35using TensorShapeRef = torch::IntArrayRef;
36
37// Bring in torch::indexing
38namespace indexing
39{
40using namespace torch::indexing;
41using TensorIndices = torch::SmallVector<TensorIndex>;
42using TensorIndicesRef = torch::ArrayRef<TensorIndex>;
43}
44
58torch::TensorOptions & default_tensor_options();
60torch::TensorOptions & default_integer_tensor_options();
62torch::Dtype & default_dtype();
64torch::Dtype & default_integer_dtype();
66torch::Device & default_device();
68
74Real & tolerance();
78
80std::string & buffer_name_separator();
82std::string & parameter_name_separator();
83
91} // namespace neml2
The wrapper (decorator) for cross-referencing unresolved values at parse time.
Definition CrossRef.h:56
torch::SmallVector< TensorIndex > TensorIndices
Definition types.h:41
torch::ArrayRef< TensorIndex > TensorIndicesRef
Definition types.h:42
Definition CrossRef.cxx:30
torch::Device & default_device()
Default device.
Definition types.cxx:60
torch::TensorOptions & default_integer_tensor_options()
Default integral tensor options.
Definition types.cxx:38
torch::TensorOptions & default_tensor_options()
Definition types.cxx:30
std::string & buffer_name_separator()
Default nested buffer name separator.
Definition types.cxx:88
torch::Dtype & default_dtype()
Default floating point type.
Definition types.cxx:46
torch::SmallVector< Size > TensorShape
Definition types.h:34
torch::Dtype & default_integer_dtype()
Default integral type.
Definition types.cxx:53
bool & currently_solving_nonlinear_system()
Definition types.cxx:102
Real & machine_precision()
Definition types.cxx:67
Real & tolerance()
The tolerance used in various algorithms.
Definition types.cxx:74
torch::IntArrayRef TensorShapeRef
Definition types.h:35
Real & tighter_tolerance()
A tighter tolerance used in various algorithms.
Definition types.cxx:81
std::string & parameter_name_separator()
Default nested parameter name separator.
Definition types.cxx:95