Txeo v0.1
A Developer-Friendly TensorFlow C++ Wrapper
Loading...
Searching...
No Matches
TensorOp.h
Go to the documentation of this file.
1#ifndef TENSOROP_H
2#define TENSOROP_H
3#pragma once
4
5#include "txeo/Matrix.h"
6#include "txeo/Tensor.h"
7#include "txeo/Vector.h"
8
9#include <stdexcept>
10
11namespace txeo {
12template <typename T>
13class Vector;
14
24template <typename T>
25class TensorOp {
26 public:
27 TensorOp(const TensorOp &) = delete;
28 TensorOp(TensorOp &&) = delete;
29 TensorOp &operator=(const TensorOp &) = delete;
31 ~TensorOp() = default;
32
50
67
83
97
115
132
147
162
178
192 static const T &subtract_by(const T &left, txeo::Tensor<T> &right);
193
208
222
238
252
268
283
301
319
336
352
371
390 const txeo::Tensor<T> &right);
391
410
428
429 private:
430 TensorOp() = default;
431};
432
437class TensorOpError : public std::runtime_error {
438 public:
439 using std::runtime_error::runtime_error;
440};
441
442} // namespace txeo
443#endif
A container for managing training, evaluation, and test data splits.
Definition DataTable.h:24
Exceptions concerning txeo::TensorOp.
Definition TensorOp.h:437
A utility class for performing operations on tensors and vectors.
Definition TensorOp.h:25
static const T & subtract_by(const T &left, txeo::Tensor< T > &right)
In-place element-wise subtraction of tensor from scalar.
static txeo::Tensor< T > & divide_by(txeo::Tensor< T > &left, const T &right)
In-place element-wise division of tensor by scalar.
static T inner(const txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Computes the inner product of two tensors.
static txeo::Tensor< T > & sum_by(txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Sums the left operand with the right operand (in-place)
static txeo::Matrix< T > dot(const txeo::Matrix< T > &left, const txeo::Matrix< T > &right)
Computes the matrix product of two matrices.
static txeo::Tensor< T > sum(const txeo::Tensor< T > &left, const T &right)
Element-wise sum of tensor and scalar (out-of-place)
static txeo::Tensor< T > & hadamard_prod_by(txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Performs element-wise multiplication of the left operand by the right operand (in-place)
static txeo::Tensor< T > subtract(const txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Returns the subtraction of two tensors.
static txeo::Tensor< T > divide(const T &left, const txeo::Tensor< T > &right)
Element-wise division of scalar by tensor (out-of-place)
static txeo::Tensor< T > multiply(const txeo::Tensor< T > &left, const T &right)
Returns the multiplication of a tensor and a scalar.
~TensorOp()=default
static txeo::Tensor< T > hadamard_div(const txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Element-wise Hadamard division (out-of-place)
static txeo::Tensor< T > & subtract_by(txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Subtracts the left operand by the right operand (in-place)
TensorOp(TensorOp &&)=delete
static txeo::Tensor< T > & divide_by(const T &scalar, txeo::Tensor< T > &tensor)
In-place element-wise division of scalar by tensor elements.
static txeo::Tensor< T > hadamard_prod(const txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Returns the element-wise product (Hadamard Product) of two tensors.
static txeo::Tensor< T > dot(const txeo::Matrix< T > &left, const txeo::Vector< T > &right)
Computes the matrix product of a matrix and a vector.
static txeo::Tensor< T > subtract(const txeo::Tensor< T > &left, const T &right)
Element-wise subtraction of scalar from tensor (out-of-place)
TensorOp & operator=(const TensorOp &)=delete
static txeo::Tensor< T > & multiply_by(txeo::Tensor< T > &left, const T &right)
Multiplies the tensor by a scalar (in-place)
static txeo::Tensor< T > product_tensors(const txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Computes the matrix product of two second order tensors.
static txeo::Tensor< T > & sum_by(txeo::Tensor< T > &left, const T &right)
In-place element-wise addition of scalar to tensor.
static txeo::Tensor< T > divide(const txeo::Tensor< T > &left, const T &right)
Element-wise division of tensor by scalar (out-of-place)
TensorOp(const TensorOp &)=delete
static txeo::Tensor< T > & hadamard_div_by(txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
In-place element-wise Hadamard division.
static txeo::Tensor< T > sum(const txeo::Tensor< T > &left, const txeo::Tensor< T > &right)
Returns the sum of two tensors.
static txeo::Tensor< T > subtract(const T &left, const txeo::Tensor< T > &right)
Element-wise subtraction of tensor from scalar (out-of-place)
static txeo::Tensor< T > & subtract_by(txeo::Tensor< T > &left, const T &right)
In-place element-wise subtraction of scalar from tensor.
TensorOp & operator=(TensorOp &&)=delete