Txeo v0.1
A Developer-Friendly TensorFlow C++ Wrapper
Loading...
Searching...
No Matches
TensorFunc.h
Go to the documentation of this file.
1#ifndef TENSORFUNC_H
2#define TENSORFUNC_H
3#pragma once
4
5#include "txeo/Matrix.h"
6#include "txeo/Tensor.h"
7
8#include <cstddef>
9
10namespace txeo {
11
22template <typename T>
24 public:
25 TensorFunc(const TensorFunc &) = delete;
26 TensorFunc(TensorFunc &&) = delete;
27 TensorFunc &operator=(const TensorFunc &) = default;
29 ~TensorFunc() = default;
30
44 static txeo::Tensor<T> power_elem(const txeo::Tensor<T> &tensor, const T &exponent);
45
58 static txeo::Tensor<T> power_elem_by(txeo::Tensor<T> &tensor, const T &exponent);
59
73 static txeo::Tensor<T> square(const txeo::Tensor<T> &tensor);
74
88
102 static txeo::Tensor<T> sqrt(const txeo::Tensor<T> &tensor);
103
117
130 static txeo::Tensor<T> abs(const txeo::Tensor<T> &tensor);
131
145
168 static txeo::Tensor<T> permute(const txeo::Tensor<T> &tensor, const std::vector<size_t> &axes);
169
190 static txeo::Tensor<T> &permute_by(txeo::Tensor<T> &tensor, const std::vector<size_t> &axes);
191
206
221
222 private:
223 TensorFunc() = default;
224};
225
230class TensorFuncError : public std::runtime_error {
231 public:
232 using std::runtime_error::runtime_error;
233};
234
235} // namespace txeo
236
237#endif
A class representing a matrix, derived from Tensor.
Definition Matrix.h:42
Exceptions concerning txeo::TensorOp.
Definition TensorFunc.h:230
A utility class for common math functions on tensors.
Definition TensorFunc.h:23
static txeo::Tensor< T > & square_by(txeo::Tensor< T > &tensor)
Computes the element-wise square of a tensor in-place.
static txeo::Tensor< T > power_elem(const txeo::Tensor< T > &tensor, const T &exponent)
Returns the element-wise potentiation of a tensor.
TensorFunc & operator=(TensorFunc &&)=delete
static txeo::Tensor< T > sqrt(const txeo::Tensor< T > &tensor)
Computes the element-wise square root of a tensor.
static txeo::Tensor< T > permute(const txeo::Tensor< T > &tensor, const std::vector< size_t > &axes)
Permutes the axes of a tensor.
static txeo::Matrix< T > & transpose_by(txeo::Matrix< T > &matrix)
Transposes a matrix in-place.
TensorFunc(const TensorFunc &)=delete
static txeo::Tensor< T > & sqrt_by(txeo::Tensor< T > &tensor)
Computes the element-wise square root of a tensor in-place.
static txeo::Tensor< T > & abs_by(txeo::Tensor< T > &tensor)
Computes the element-wise absolute value of a tensor in-place.
~TensorFunc()=default
static txeo::Matrix< T > transpose(const txeo::Matrix< T > &matrix)
Transposes a matrix.
TensorFunc & operator=(const TensorFunc &)=default
static txeo::Tensor< T > square(const txeo::Tensor< T > &tensor)
Computes the element-wise square of a tensor.
static txeo::Tensor< T > abs(const txeo::Tensor< T > &tensor)
Computes the element-wise absolute value of a tensor.
TensorFunc(TensorFunc &&)=delete
static txeo::Tensor< T > & permute_by(txeo::Tensor< T > &tensor, const std::vector< size_t > &axes)
Permutes the axes of a tensor in-place.
static txeo::Tensor< T > power_elem_by(txeo::Tensor< T > &tensor, const T &exponent)
Performs element-wise potentiation of the tensor (in-place)
Implements the mathematical concept of tensor, which is a magnitude of multiple order....
Definition Tensor.h:48
Definition Matrix.h:11