 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
10 #include <initializer_list>
17 namespace tensor_init {
24 template <
typename T,
size_t D>
26 using type = std::initializer_list<
35 template <
typename T,
size_t D>
40 static constexpr
size_t value = 0;
51 static constexpr
size_t value(
const L& list) {
52 if (list.size() == 0) {
56 for (
const auto&
value : list) {
59 "Input contains ragged nested sequences"
60 "(nested lists with unequal sizes or shapes).");
70 static constexpr
size_t value(
const L& list) {
75 template <
typename L,
size_t... D>
87 while (shape.size() > (last_dim + 1) && shape[last_dim] != 0) {
90 shape.resize(last_dim + 1);
94 template <
typename T,
typename L>
99 template <
typename T,
typename L>
100 void NestedCopy(T&& iter,
const std::initializer_list<L>& list) {
101 for (
const auto& value : list) {
106 template <
typename T,
size_t D>
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
SizeVector InitializerShape(const L &list, std::index_sequence< D... >)
Definition: TensorInit.h:76
Definition: TensorInit.h:25
std::initializer_list< typename NestedInitializerImpl< T, D - 1 >::type > type
Definition: TensorInit.h:27
static constexpr size_t value(const L &list)
Definition: TensorInit.h:70
std::vector< T > ToFlatVector(const SizeVector &shape, const tensor_init::NestedInitializerList< T, D > &nested_list)
Definition: TensorInit.h:107
Definition: TensorInit.h:39
int64_t NumElements() const
Definition: SizeVector.cpp:108
Definition: SizeVector.h:70
static constexpr size_t value(const L &list)
Definition: TensorInit.h:51
#define LogError(...)
Definition: Logging.h:60
SizeVector InferShape(const L &list)
Definition: TensorInit.h:82
void NestedCopy(T &&iter, const L &list)
Definition: TensorInit.h:95
typename NestedInitializerImpl< T, D >::type NestedInitializerList
Definition: TensorInit.h:36
static constexpr size_t value
Definition: TensorInit.h:40
T type
Definition: TensorInit.h:32
Definition: TensorInit.h:49