67template<
typename ReduceOp>
70 return t.reduce(op, axis);
83template<
typename ReduceIndexOp>
86 return t.reduceWithIndex(op, axis);
101template<
typename Func>
120template<
typename Func>
123 return t.map(f, axis);
138template<
typename... Args>
141 return t.reshape(newShape);
154template<
typename... Args>
156 return [=](
NN::Tensor&& tensor) -> tl::expected<NN::Tensor, NN::NeuralError> {
157 auto result = tensor.squeeze();
159 return tl::unexpected(result.error());
161 return std::move(tensor);
176template<
typename... Args>
178 return [=](
NN::Tensor&& tensor) -> tl::expected<NN::Tensor,NN::NeuralError> {
179 auto result = tensor.squeeze(axis);
181 return tl::unexpected(result.error());
183 return std::move(tensor);
199template<
typename... Args>
201 return [=](
NN::Tensor&& tensor) -> tl::expected<NN::Tensor,NN::NeuralError> {
202 auto result = tensor.unsqueeze(axis);
204 return tl::unexpected(result.error());
206 return std::move(tensor);
216template<
typename... Args>
219 return tensor.toCvMat();
229template<
typename T,
typename... Args>
232 return tensor.toVector<T>();
247template<
typename... Args>
250 return model->infer(input);
Contains the NeuralNet interface for neural network inference.
Contains the Tensor class for representing N-dimensional arrays with various data types.
A Tensor represents a N-dimensional array containing elements of the same type. Can be used as input ...
Definition Tensor.h:201
std::shared_ptr< NeuralNet > NeuralNetPtr
Smart pointer type for managing NeuralNet instances.
Definition NeuralNet.h:95
auto bind_map(Func f)
Binds a mapping operation on a tensor.
Definition NeuralUtil.h:102
auto bind_toVector()
Binds a conversion operation from a tensor to a vector.
Definition NeuralUtil.h:230
auto bind_reshape(const std::vector< int64_t > &newShape)
Binds a reshape operation to change the shape of a tensor.
Definition NeuralUtil.h:139
auto bind_inference(NN::NeuralNetPtr model)
Binds an inference operation on a neural network model.
Definition NeuralUtil.h:248
auto bind_toCvMat()
Binds a conversion operation from a tensor to an OpenCV Mat format.
Definition NeuralUtil.h:217
auto bind_squeeze()
Binds a squeeze operation to remove dimensions of size 1 from a tensor.
Definition NeuralUtil.h:155
auto bind_reduceWithIndex(ReduceIndexOp op, int axis)
Binds a reduction operation with index on a specified axis for a tensor.
Definition NeuralUtil.h:84
auto bind_reduce(ReduceOp op, int axis)
Binds a reduction operation on a specified axis for a tensor.
Definition NeuralUtil.h:68
auto bind_unsqueeze(int64_t axis)
Binds an unsqueeze operation to add a new dimension of size 1 at a specified axis in a tensor.
Definition NeuralUtil.h:200
Namespace for utility functions related to neural networks and tensors.
Definition NeuralUtil.h:56