ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
TensorFunction.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <Optional.h>
11 
13 
14 namespace cloudViewer {
15 namespace core {
16 
56 Tensor Concatenate(const std::vector<Tensor>& tensors,
57  const utility::optional<int64_t>& axis = 0);
58 
91 Tensor Append(const Tensor& self,
92  const Tensor& other,
93  const utility::optional<int64_t>& axis = utility::nullopt);
94 
103 Tensor Maximum(const Tensor& input, const Tensor& other);
104 
113 Tensor Minimum(const Tensor& input, const Tensor& other);
114 
115 } // namespace core
116 } // namespace cloudViewer
cloudViewer::utility::optional::value
constexpr T const & value() const &
Definition: Optional.h:465
cloudViewer
Generic file read and write utility for python interface.
Definition: CloudViewerConfig.cpp:12
cloudViewer::core::Tensor::GetDtype
Dtype GetDtype() const
Definition: Tensor.h:1164
Kernel.h
Optional.h
cloudViewer::core::shape_util::BroadcastedShape
SizeVector BroadcastedShape(const SizeVector &l_shape, const SizeVector &r_shape)
Returns the broadcasted shape of two shapes.
Definition: ShapeUtil.cpp:56
cloudViewer::utility::optional::has_value
constexpr bool has_value() const noexcept
Definition: Optional.h:440
cloudViewer::core::Tensor::GetShape
SizeVector GetShape() const
Definition: Tensor.h:1127
cloudViewer::core::Tensor::Reshape
Tensor Reshape(const SizeVector &dst_shape) const
Definition: Tensor.cpp:671
AssertTensorDevice
#define AssertTensorDevice(tensor,...)
Definition: TensorCheck.h:45
cloudViewer::core::Maximum
Tensor Maximum(const Tensor &input, const Tensor &other)
Computes the element-wise maximum of input and other. The tensors must have same data type and device...
Definition: TensorFunction.cpp:124
cloudViewer::core::kernel::BinaryEWOpCode::Maximum
@ Maximum
cloudViewer::core::kernel::BinaryEWOpCode::Minimum
@ Minimum
cloudViewer::core::Minimum
Tensor Minimum(const Tensor &input, const Tensor &other)
Computes the element-wise minimum of input and other. The tensors must have same data type and device...
Definition: TensorFunction.cpp:136
cloudViewer::core::Tensor
Definition: Tensor.h:32
cloudViewer::core::shape_util::WrapDim
int64_t WrapDim(int64_t dim, int64_t max_dim, bool inclusive)
Wrap around negative dim.
Definition: ShapeUtil.cpp:131
cloudViewer::core::Dtype
Definition: Dtype.h:21
cloudViewer::core::Tensor::NumDims
int64_t NumDims() const
Definition: Tensor.h:1172
cloudViewer::core::Tensor::SetItem
Tensor SetItem(const Tensor &value)
Set all items. Equivalent to tensor[:] = value in Python.
Definition: Tensor.cpp:564
cloudViewer::core::Device
Definition: Device.h:18
core
cloudViewer::core::Append
Tensor Append(const Tensor &self, const Tensor &other, const utility::optional< int64_t > &axis)
Appends the two tensors, along the given axis into a new tensor. Both the tensors must have same data...
Definition: TensorFunction.cpp:118
cloudViewer::core::Tensor::GetDevice
Device GetDevice() const override
Definition: Tensor.cpp:1435
cloudViewer::core::SizeVector
Definition: SizeVector.h:70
cloudViewer::core::ConcatenateImpl
static Tensor ConcatenateImpl(const std::vector< Tensor > &tensors, const int64_t axis)
Definition: TensorFunction.cpp:15
cloudViewer::utility::optional< int64_t >
LogError
#define LogError(...)
Definition: Logging.h:60
cloudViewer::core::Concatenate
Tensor Concatenate(const std::vector< Tensor > &tensors, const utility::optional< int64_t > &axis)
Concatenates the list of tensors in their order, along the given axis into a new tensor....
Definition: TensorFunction.cpp:79
cloudViewer::core::TensorKey::Slice
static TensorKey Slice(utility::optional< int64_t > start, utility::optional< int64_t > stop, utility::optional< int64_t > step)
Definition: TensorKey.cpp:138
AssertTensorDtype
#define AssertTensorDtype(tensor,...)
Definition: TensorCheck.h:21
cloudViewer::utility::nullopt
constexpr nullopt_t nullopt
Definition: Optional.h:136
Tensor.h
cloudViewer::core::kernel::BinaryEW
void BinaryEW(const Tensor &lhs, const Tensor &rhs, Tensor &dst, BinaryEWOpCode op_code)
Definition: BinaryEW.cpp:30
TensorFunction.h