 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
66 :
TensorList(tensors.begin(), tensors.end()) {}
92 :
TensorList(tensors.begin(), tensors.end()) {}
99 template <
class InputIterator>
104 "Empty input tensors cannot initialize a tensorlist.");
113 std::for_each(begin, end, [&](
const Tensor& tensor) ->
void {
116 "Tensors must have the same shape {}, but got {}.",
117 element_shape_, tensor.GetShape());
122 Dtype dtype = begin->GetDtype();
123 std::for_each(begin, end, [&](
const Tensor& tensor) ->
void {
126 "Tensors must have the same dtype {}, but got {}.",
127 dtype.ToString(), tensor.GetDtype().ToString());
132 Device device = begin->GetDevice();
133 std::for_each(begin, end, [&](
const Tensor& tensor) ->
void {
136 "Tensors must have the same device {}, but got {}.",
137 device.ToString(), tensor.GetDevice().ToString());
146 for (
auto iter = begin; iter != end; ++iter, ++i) {
198 void Resize(int64_t new_size);
246 "TensorList has element shape {}, but is expected to have "
255 "TensorList has device {}, but is expected to be {}.",
276 int64_t reserved_size,
277 const Tensor& internal_tensor,
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
Dtype GetDtype() const
Definition: Tensor.h:1164
Tensor Clone() const
Copy Tensor to the same device.
Definition: Tensor.h:502
TensorList & operator+=(const TensorList &other)
Definition: TensorList.h:226
bool is_resizable_
Definition: TensorList.h:325
SizeVector GetShape() const
Definition: Tensor.h:1127
SizeVector Concat(const SizeVector &l_shape, const SizeVector &r_shape)
Concatenate two shapes.
Definition: ShapeUtil.cpp:199
static int64_t ComputeReserveSize(int64_t size)
Definition: TensorList.cpp:156
void Fill(S v)
Fill the whole Tensor with a scalar value, the scalar will be casted to the Tensor's Dtype.
Definition: Tensor.h:1400
filament::Texture::InternalFormat format
Definition: FilamentResourceManager.cpp:181
static void AssertIsResizable(const TensorList &tensorlist, const std::string &func_name)
Asserts that the tensor list is resizable.
Definition: TensorList.cpp:18
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:45
bool IsContiguous() const
Definition: Tensor.h:1036
Device GetDevice() const
Definition: TensorList.h:260
void AssertDevice(const Device &expected_device) const
Definition: TensorList.h:252
Tensor Slice(int64_t dim, int64_t start, int64_t stop, int64_t step=1) const
Definition: Tensor.cpp:857
int64_t WrapDim(int64_t dim, int64_t max_dim, bool inclusive)
Wrap around negative dim.
Definition: ShapeUtil.cpp:131
TensorList(const std::initializer_list< Tensor > &tensors)
Definition: TensorList.h:91
Tensor AsTensor() const
Return the reference of the contained valid tensors with shared memory.
Definition: TensorList.cpp:70
std::string ToString() const
Returns string representation of device, e.g. "CPU:0", "CUDA:0".
Definition: Device.cpp:89
int64_t GetSize() const
Definition: TensorList.h:264
core::Tensor result
Definition: VtkUtils.cpp:76
void Extend(const TensorList &other)
Definition: TensorList.cpp:94
SizeVector element_shape_
The shape for each element tensor in the tensorlist.
Definition: TensorList.h:301
int size
Definition: FileIOFactory.cpp:130
TensorList(const std::vector< Tensor > &tensors)
Definition: TensorList.h:65
Tensor operator[](int64_t index) const
Definition: TensorList.cpp:128
void CopyFrom(const TensorList &other)
Definition: TensorList.cpp:62
std::string ToString() const
Definition: SizeVector.cpp:132
void PushBack(const Tensor &tensor)
Definition: TensorList.cpp:83
std::string ToString() const
Definition: TensorList.cpp:185
math::float4 next
Definition: LineSetBuffers.cpp:45
std::string ToString() const
Definition: Dtype.h:65
Definition: TensorList.h:39
a[190]
Definition: essential_matrix_poly.h:19
Device GetDevice() const override
Definition: Tensor.cpp:1435
int64_t GetReservedSize() const
Definition: TensorList.h:266
TensorList & operator=(const TensorList &other) &=default
TensorList(InputIterator begin, InputIterator end)
Definition: TensorList.h:100
const Dtype Float32
Definition: Dtype.cpp:42
TensorList(const SizeVector &element_shape, Dtype dtype, const Device &device=Device("CPU:0"))
Definition: TensorList.h:50
bool IsResizable() const
Definition: TensorList.h:270
Definition: SizeVector.h:70
#define LogError(...)
Definition: Logging.h:60
TensorList operator+(const TensorList &other) const
Concatenate two tensorlists.
Definition: TensorList.h:220
TensorList Clone() const
Definition: TensorList.cpp:56
void Resize(int64_t new_size)
Definition: TensorList.cpp:74
int64_t reserved_size_
Definition: TensorList.h:317
#define AssertTensorDtype(tensor,...)
Definition: TensorCheck.h:21
static Tensor Empty(const SizeVector &shape, Dtype dtype, const Device &device=Device("CPU:0"))
Create a tensor with uninitialized values.
Definition: Tensor.cpp:400
TensorList()
Useful to support operator[] in a map.
Definition: TensorList.h:42
SizeVector GetElementShape() const
Definition: TensorList.h:241
Dtype GetDtype() const
Definition: TensorList.h:262
void AssertElementShape(const SizeVector &expected_element_shape) const
Definition: TensorList.h:243
static TensorList Concatenate(const TensorList &a, const TensorList &b)
Definition: TensorList.cpp:121
Tensor internal_tensor_
The internal tensor for data storage.
Definition: TensorList.h:320
#define AssertTensorShape(tensor,...)
Definition: TensorCheck.h:61
TensorList(const SizeVector element_shape, int64_t size, int64_t reserved_size, const Tensor &internal_tensor, bool is_resizable)
Fully specified constructor.
Definition: TensorList.h:274
void Clear()
Definition: TensorList.cpp:134
static TensorList FromTensor(const Tensor &tensor, bool inplace=false)
Definition: TensorList.cpp:28
static double distance(T *pot1, T *pot2)
Definition: utils.h:111
int64_t size_
Definition: TensorList.h:306
void ResizeWithExpand(int64_t new_size)
Definition: TensorList.cpp:140
TensorList(int64_t size, const SizeVector &element_shape, Dtype dtype, const Device &device=Device("CPU:0"))
Definition: TensorList.h:75