mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 03:39:01 +08:00
Fixed the formatting of the README.
This commit is contained in:
parent
56df5ef1d7
commit
aa45ad2aac
@ -11,7 +11,7 @@ You can manipulate a tensor with one of the following classes. They all are in
|
|||||||
the namespace ```::Eigen.```
|
the namespace ```::Eigen.```
|
||||||
|
|
||||||
|
|
||||||
### Class Tensor<data_type, rank>;
|
### Class Tensor<data_type, rank>
|
||||||
|
|
||||||
This is the class to use to create a tensor and allocate memory for it. The
|
This is the class to use to create a tensor and allocate memory for it. The
|
||||||
class is templatized with the tensor datatype, such as float or int, and the
|
class is templatized with the tensor datatype, such as float or int, and the
|
||||||
@ -21,7 +21,7 @@ matrix.
|
|||||||
Tensors of this class are resizable. For example, if you assign a tensor of a
|
Tensors of this class are resizable. For example, if you assign a tensor of a
|
||||||
different size to a Tensor, that tensor is resized to match its new value.
|
different size to a Tensor, that tensor is resized to match its new value.
|
||||||
|
|
||||||
#### Constructor Tensor<data_type, rank>(size0, size1, ...)
|
#### Constructor Tensor<data_type, rank>(size0, size1, ...)
|
||||||
|
|
||||||
Constructor for a Tensor. The constructor must be passed ```rank``` integers
|
Constructor for a Tensor. The constructor must be passed ```rank``` integers
|
||||||
indicating the sizes of the instance along each of the the ```rank```
|
indicating the sizes of the instance along each of the the ```rank```
|
||||||
@ -34,18 +34,18 @@ dimensions.
|
|||||||
// Resize t_3d by assigning a tensor of different sizes, but same rank.
|
// Resize t_3d by assigning a tensor of different sizes, but same rank.
|
||||||
t_3d = Tensor<float, 3>(3, 4, 3);
|
t_3d = Tensor<float, 3>(3, 4, 3);
|
||||||
|
|
||||||
#### Constructor Tensor<data_type, rank>(size_array)
|
#### Constructor Tensor<data_type, rank>(size_array)
|
||||||
|
|
||||||
Constructor where the sizes for the constructor are specified as an array of
|
Constructor where the sizes for the constructor are specified as an array of
|
||||||
values instead of an explicitly list of parameters. The array type to use is
|
values instead of an explicitly list of parameters. The array type to use is
|
||||||
```Eigen::array<Eigen::Index>```. The array can be constructed automatically
|
```Eigen::array<Eigen::Index>```. The array can be constructed automatically
|
||||||
from an initializer list.
|
from an initializer list.
|
||||||
|
|
||||||
// Create a tensor of strings of rank 2 with sizes 5, 7.
|
// Create a tensor of strings of rank 2 with sizes 5, 7.
|
||||||
Tensor<string, 2> t_2d({5, 7});
|
Tensor<string, 2> t_2d({5, 7});
|
||||||
|
|
||||||
|
|
||||||
### Class TensorFixedSize<data_type, Sizes<size0, size1, ...>>
|
### Class TensorFixedSize<data_type, Sizes<size0, size1, ...>>
|
||||||
|
|
||||||
Class to use for tensors of fixed size, where the size is known at compile
|
Class to use for tensors of fixed size, where the size is known at compile
|
||||||
time. Fixed sized tensors can provide very fast computations because all their
|
time. Fixed sized tensors can provide very fast computations because all their
|
||||||
@ -57,7 +57,7 @@ tensor data is held onto the stack and does not cause heap allocation and free.
|
|||||||
// Create a 4 x 3 tensor of floats.
|
// Create a 4 x 3 tensor of floats.
|
||||||
TensorFixedSize<float, Sizes<4, 3>> t_4x3;
|
TensorFixedSize<float, Sizes<4, 3>> t_4x3;
|
||||||
|
|
||||||
### Class TensorMap<Tensor<data_type, rank>>
|
### Class TensorMap<Tensor<data_type, rank>>
|
||||||
|
|
||||||
This is the class to use to create a tensor on top of memory allocated and
|
This is the class to use to create a tensor on top of memory allocated and
|
||||||
owned by another part of your code. It allows to view any piece of allocated
|
owned by another part of your code. It allows to view any piece of allocated
|
||||||
@ -67,7 +67,7 @@ data are stored.
|
|||||||
A TensorMap is not resizable because it does not own the memory where its data
|
A TensorMap is not resizable because it does not own the memory where its data
|
||||||
are stored.
|
are stored.
|
||||||
|
|
||||||
#### Constructor TensorMap<Tensor<data_type, rank>>(data, size0, size1, ...)
|
#### Constructor TensorMap<Tensor<data_type, rank>>(data, size0, size1, ...)
|
||||||
|
|
||||||
Constructor for a Tensor. The constructor must be passed a pointer to the
|
Constructor for a Tensor. The constructor must be passed a pointer to the
|
||||||
storage for the data, and "rank" size attributes. The storage has to be
|
storage for the data, and "rank" size attributes. The storage has to be
|
||||||
@ -93,7 +93,7 @@ See Assigning to a TensorRef below.
|
|||||||
|
|
||||||
## Accessing Tensor Elements
|
## Accessing Tensor Elements
|
||||||
|
|
||||||
#### <data_type> tensor(index0, index1...)
|
#### <data_type> tensor(index0, index1...)
|
||||||
|
|
||||||
Return the element at position ```(index0, index1...)``` in tensor
|
Return the element at position ```(index0, index1...)``` in tensor
|
||||||
```tensor```. You must pass as many parameters as the rank of ```tensor```.
|
```tensor```. You must pass as many parameters as the rank of ```tensor```.
|
||||||
@ -175,7 +175,7 @@ the following code computes the elementwise addition of two tensors:
|
|||||||
While the code above looks easy enough, it is important to understand that the
|
While the code above looks easy enough, it is important to understand that the
|
||||||
expression ```t1 + t2``` is not actually adding the values of the tensors. The
|
expression ```t1 + t2``` is not actually adding the values of the tensors. The
|
||||||
expression instead constructs a "tensor operator" object of the class
|
expression instead constructs a "tensor operator" object of the class
|
||||||
TensorCwiseBinaryOp<scalar_sum>, which has references to the tensors
|
TensorCwiseBinaryOp<scalar_sum>, which has references to the tensors
|
||||||
```t1``` and ```t2```. This is a small C++ object that knows how to add
|
```t1``` and ```t2```. This is a small C++ object that knows how to add
|
||||||
```t1``` and ```t2```. It is only when the value of the expression is assigned
|
```t1``` and ```t2```. It is only when the value of the expression is assigned
|
||||||
to the tensor ```t3``` that the addition is actually performed. Technically,
|
to the tensor ```t3``` that the addition is actually performed. Technically,
|
||||||
@ -452,24 +452,24 @@ memory for tensors with cuda.
|
|||||||
In the documentation of the tensor methods and Operation we mention datatypes
|
In the documentation of the tensor methods and Operation we mention datatypes
|
||||||
that are tensor-type specific:
|
that are tensor-type specific:
|
||||||
|
|
||||||
#### <Tensor-Type>::Dimensions
|
#### <Tensor-Type>::Dimensions
|
||||||
|
|
||||||
Acts like an array of ints. Has an ```int size``` attribute, and can be
|
Acts like an array of ints. Has an ```int size``` attribute, and can be
|
||||||
indexed like an array to access individual values. Used to represent the
|
indexed like an array to access individual values. Used to represent the
|
||||||
dimensions of a tensor. See ```dimensions()```.
|
dimensions of a tensor. See ```dimensions()```.
|
||||||
|
|
||||||
#### <Tensor-Type>::Index
|
#### <Tensor-Type>::Index
|
||||||
|
|
||||||
Acts like an ```int```. Used for indexing tensors along their dimensions. See
|
Acts like an ```int```. Used for indexing tensors along their dimensions. See
|
||||||
```operator()```, ```dimension()```, and ```size()```.
|
```operator()```, ```dimension()```, and ```size()```.
|
||||||
|
|
||||||
#### <Tensor-Type>::Scalar
|
#### <Tensor-Type>::Scalar
|
||||||
|
|
||||||
Represents the datatype of individual tensor elements. For example, for a
|
Represents the datatype of individual tensor elements. For example, for a
|
||||||
```Tensor<float>```, ```Scalar``` is the type ```float```. See
|
```Tensor<float>```, ```Scalar``` is the type ```float```. See
|
||||||
```setConstant()```.
|
```setConstant()```.
|
||||||
|
|
||||||
#### <Operation>
|
#### <Operation>
|
||||||
|
|
||||||
We use this pseudo type to indicate that a tensor Operation is returned by a
|
We use this pseudo type to indicate that a tensor Operation is returned by a
|
||||||
method. We indicate in the text the type and dimensions of the tensor that the
|
method. We indicate in the text the type and dimensions of the tensor that the
|
||||||
@ -602,7 +602,7 @@ You can use one of the methods below to initialize the tensor memory. These
|
|||||||
have an immediate effect on the tensor and return the tensor itself as a
|
have an immediate effect on the tensor and return the tensor itself as a
|
||||||
result. These are not tensor Operations which delay evaluation.
|
result. These are not tensor Operations which delay evaluation.
|
||||||
|
|
||||||
### <Tensor-Type> setConstant(const Scalar& val)
|
### <Tensor-Type> setConstant(const Scalar& val)
|
||||||
|
|
||||||
Sets all elements of the tensor to the constant value ```val```. ```Scalar```
|
Sets all elements of the tensor to the constant value ```val```. ```Scalar```
|
||||||
is the type of data stored in the tensor. You can pass any value that is
|
is the type of data stored in the tensor. You can pass any value that is
|
||||||
@ -630,7 +630,7 @@ has a copy constructor and an ```operator=()```:
|
|||||||
yolo yolo yolo
|
yolo yolo yolo
|
||||||
|
|
||||||
|
|
||||||
### <Tensor-Type> setZero()
|
### <Tensor-Type> setZero()
|
||||||
|
|
||||||
Fills the tensor with zeros. Equivalent to ```setConstant(Scalar(0))```.
|
Fills the tensor with zeros. Equivalent to ```setConstant(Scalar(0))```.
|
||||||
Returns the tensor itself in case you want to chain another call.
|
Returns the tensor itself in case you want to chain another call.
|
||||||
@ -644,7 +644,7 @@ Returns the tensor itself in case you want to chain another call.
|
|||||||
0 0 0 0
|
0 0 0 0
|
||||||
|
|
||||||
|
|
||||||
### <Tensor-Type> setValues({..initializer_list})
|
### <Tensor-Type> setValues({..initializer_list})
|
||||||
|
|
||||||
Fills the tensor with explicit values specified in a std::initializer_list.
|
Fills the tensor with explicit values specified in a std::initializer_list.
|
||||||
The type of the initializer list depends on the type and rank of the tensor.
|
The type of the initializer list depends on the type and rank of the tensor.
|
||||||
@ -680,7 +680,7 @@ code only sets the values of the first row of the tensor.
|
|||||||
10 20 30
|
10 20 30
|
||||||
1000 1000 1000
|
1000 1000 1000
|
||||||
|
|
||||||
### <Tensor-Type> setRandom()
|
### <Tensor-Type> setRandom()
|
||||||
|
|
||||||
Fills the tensor with random values. Returns the tensor itself in case you
|
Fills the tensor with random values. Returns the tensor itself in case you
|
||||||
want to chain another call.
|
want to chain another call.
|
||||||
@ -775,7 +775,7 @@ The chain of Operation is evaluated lazily, typically when it is assigned to a
|
|||||||
tensor. See "Controlling when Expression are Evaluated" for more details about
|
tensor. See "Controlling when Expression are Evaluated" for more details about
|
||||||
their evaluation.
|
their evaluation.
|
||||||
|
|
||||||
### <Operation> constant(const Scalar& val)
|
### <Operation> constant(const Scalar& val)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor but
|
Returns a tensor of the same type and dimensions as the original tensor but
|
||||||
where all elements have the value ```val```.
|
where all elements have the value ```val```.
|
||||||
@ -803,7 +803,7 @@ tensor, or multiply every element of a tensor by a scalar.
|
|||||||
0.6 0.6 0.6
|
0.6 0.6 0.6
|
||||||
0.6 0.6 0.6
|
0.6 0.6 0.6
|
||||||
|
|
||||||
### <Operation> random()
|
### <Operation> random()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the current tensor
|
Returns a tensor of the same type and dimensions as the current tensor
|
||||||
but where all elements have random values.
|
but where all elements have random values.
|
||||||
@ -833,7 +833,7 @@ All these operations take a single input tensor as argument and return a tensor
|
|||||||
of the same type and dimensions as the tensor to which they are applied. The
|
of the same type and dimensions as the tensor to which they are applied. The
|
||||||
requested operations are applied to each element independently.
|
requested operations are applied to each element independently.
|
||||||
|
|
||||||
### <Operation> operator-()
|
### <Operation> operator-()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the opposite values of the original tensor.
|
containing the opposite values of the original tensor.
|
||||||
@ -852,42 +852,42 @@ containing the opposite values of the original tensor.
|
|||||||
-1 -1 -1
|
-1 -1 -1
|
||||||
-1 -1 -1
|
-1 -1 -1
|
||||||
|
|
||||||
### <Operation> sqrt()
|
### <Operation> sqrt()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the square roots of the original tensor.
|
containing the square roots of the original tensor.
|
||||||
|
|
||||||
### <Operation> rsqrt()
|
### <Operation> rsqrt()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the inverse square roots of the original tensor.
|
containing the inverse square roots of the original tensor.
|
||||||
|
|
||||||
### <Operation> square()
|
### <Operation> square()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the squares of the original tensor values.
|
containing the squares of the original tensor values.
|
||||||
|
|
||||||
### <Operation> inverse()
|
### <Operation> inverse()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the inverse of the original tensor values.
|
containing the inverse of the original tensor values.
|
||||||
|
|
||||||
### <Operation> exp()
|
### <Operation> exp()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the exponential of the original tensor.
|
containing the exponential of the original tensor.
|
||||||
|
|
||||||
### <Operation> log()
|
### <Operation> log()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the natural logarithms of the original tensor.
|
containing the natural logarithms of the original tensor.
|
||||||
|
|
||||||
### <Operation> abs()
|
### <Operation> abs()
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the absolute values of the original tensor.
|
containing the absolute values of the original tensor.
|
||||||
|
|
||||||
### <Operation> pow(Scalar exponent)
|
### <Operation> pow(Scalar exponent)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the original tensor
|
Returns a tensor of the same type and dimensions as the original tensor
|
||||||
containing the coefficients of the original tensor to the power of the
|
containing the coefficients of the original tensor to the power of the
|
||||||
@ -914,17 +914,17 @@ cubic roots of an int Tensor:
|
|||||||
0 1 2
|
0 1 2
|
||||||
3 4 5
|
3 4 5
|
||||||
|
|
||||||
### <Operation> operator * (Scalar scale)
|
### <Operation> operator * (Scalar scale)
|
||||||
|
|
||||||
Multiplies all the coefficients of the input tensor by the provided scale.
|
Multiplies all the coefficients of the input tensor by the provided scale.
|
||||||
|
|
||||||
### <Operation> cwiseMax(Scalar threshold)
|
### <Operation> cwiseMax(Scalar threshold)
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
### <Operation> cwiseMin(Scalar threshold)
|
### <Operation> cwiseMin(Scalar threshold)
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
### <Operation> unaryExpr(const CustomUnaryOp& func)
|
### <Operation> unaryExpr(const CustomUnaryOp& func)
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
|
|
||||||
@ -936,39 +936,39 @@ dimensions as the tensors to which they are applied, and unless otherwise
|
|||||||
specified it is also of the same type. The requested operations are applied to
|
specified it is also of the same type. The requested operations are applied to
|
||||||
each pair of elements independently.
|
each pair of elements independently.
|
||||||
|
|
||||||
### <Operation> operator+(const OtherDerived& other)
|
### <Operation> operator+(const OtherDerived& other)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the input tensors
|
Returns a tensor of the same type and dimensions as the input tensors
|
||||||
containing the coefficient wise sums of the inputs.
|
containing the coefficient wise sums of the inputs.
|
||||||
|
|
||||||
### <Operation> operator-(const OtherDerived& other)
|
### <Operation> operator-(const OtherDerived& other)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the input tensors
|
Returns a tensor of the same type and dimensions as the input tensors
|
||||||
containing the coefficient wise differences of the inputs.
|
containing the coefficient wise differences of the inputs.
|
||||||
|
|
||||||
### <Operation> operator*(const OtherDerived& other)
|
### <Operation> operator*(const OtherDerived& other)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the input tensors
|
Returns a tensor of the same type and dimensions as the input tensors
|
||||||
containing the coefficient wise products of the inputs.
|
containing the coefficient wise products of the inputs.
|
||||||
|
|
||||||
### <Operation> operator/(const OtherDerived& other)
|
### <Operation> operator/(const OtherDerived& other)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the input tensors
|
Returns a tensor of the same type and dimensions as the input tensors
|
||||||
containing the coefficient wise quotients of the inputs.
|
containing the coefficient wise quotients of the inputs.
|
||||||
|
|
||||||
This operator is not supported for integer types.
|
This operator is not supported for integer types.
|
||||||
|
|
||||||
### <Operation> cwiseMax(const OtherDerived& other)
|
### <Operation> cwiseMax(const OtherDerived& other)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the input tensors
|
Returns a tensor of the same type and dimensions as the input tensors
|
||||||
containing the coefficient wise maximums of the inputs.
|
containing the coefficient wise maximums of the inputs.
|
||||||
|
|
||||||
### <Operation> cwiseMin(const OtherDerived& other)
|
### <Operation> cwiseMin(const OtherDerived& other)
|
||||||
|
|
||||||
Returns a tensor of the same type and dimensions as the input tensors
|
Returns a tensor of the same type and dimensions as the input tensors
|
||||||
containing the coefficient wise mimimums of the inputs.
|
containing the coefficient wise mimimums of the inputs.
|
||||||
|
|
||||||
### <Operation> Logical operators
|
### <Operation> Logical operators
|
||||||
|
|
||||||
The following logical operators are supported as well:
|
The following logical operators are supported as well:
|
||||||
|
|
||||||
@ -1119,50 +1119,50 @@ one-dimension tensor with a single value.
|
|||||||
276
|
276
|
||||||
|
|
||||||
|
|
||||||
### <Operation> sum(const Dimensions& new_dims)
|
### <Operation> sum(const Dimensions& new_dims)
|
||||||
### <Operation> sum()
|
### <Operation> sum()
|
||||||
|
|
||||||
Reduce a tensor using the sum() operator. The resulting values
|
Reduce a tensor using the sum() operator. The resulting values
|
||||||
are the sum of the reduced values.
|
are the sum of the reduced values.
|
||||||
|
|
||||||
### <Operation> mean(const Dimensions& new_dims)
|
### <Operation> mean(const Dimensions& new_dims)
|
||||||
### <Operation> mean()
|
### <Operation> mean()
|
||||||
|
|
||||||
Reduce a tensor using the mean() operator. The resulting values
|
Reduce a tensor using the mean() operator. The resulting values
|
||||||
are the mean of the reduced values.
|
are the mean of the reduced values.
|
||||||
|
|
||||||
### <Operation> maximum(const Dimensions& new_dims)
|
### <Operation> maximum(const Dimensions& new_dims)
|
||||||
### <Operation> maximum()
|
### <Operation> maximum()
|
||||||
|
|
||||||
Reduce a tensor using the maximum() operator. The resulting values are the
|
Reduce a tensor using the maximum() operator. The resulting values are the
|
||||||
largest of the reduced values.
|
largest of the reduced values.
|
||||||
|
|
||||||
### <Operation> minimum(const Dimensions& new_dims)
|
### <Operation> minimum(const Dimensions& new_dims)
|
||||||
### <Operation> minimum()
|
### <Operation> minimum()
|
||||||
|
|
||||||
Reduce a tensor using the minimum() operator. The resulting values
|
Reduce a tensor using the minimum() operator. The resulting values
|
||||||
are the smallest of the reduced values.
|
are the smallest of the reduced values.
|
||||||
|
|
||||||
### <Operation> prod(const Dimensions& new_dims)
|
### <Operation> prod(const Dimensions& new_dims)
|
||||||
### <Operation> prod()
|
### <Operation> prod()
|
||||||
|
|
||||||
Reduce a tensor using the prod() operator. The resulting values
|
Reduce a tensor using the prod() operator. The resulting values
|
||||||
are the product of the reduced values.
|
are the product of the reduced values.
|
||||||
|
|
||||||
### <Operation> all(const Dimensions& new_dims)
|
### <Operation> all(const Dimensions& new_dims)
|
||||||
### <Operation> all()
|
### <Operation> all()
|
||||||
Reduce a tensor using the all() operator. Casts tensor to bool and then checks
|
Reduce a tensor using the all() operator. Casts tensor to bool and then checks
|
||||||
whether all elements are true. Runs through all elements rather than
|
whether all elements are true. Runs through all elements rather than
|
||||||
short-circuiting, so may be significantly inefficient.
|
short-circuiting, so may be significantly inefficient.
|
||||||
|
|
||||||
### <Operation> any(const Dimensions& new_dims)
|
### <Operation> any(const Dimensions& new_dims)
|
||||||
### <Operation> any()
|
### <Operation> any()
|
||||||
Reduce a tensor using the any() operator. Casts tensor to bool and then checks
|
Reduce a tensor using the any() operator. Casts tensor to bool and then checks
|
||||||
whether any element is true. Runs through all elements rather than
|
whether any element is true. Runs through all elements rather than
|
||||||
short-circuiting, so may be significantly inefficient.
|
short-circuiting, so may be significantly inefficient.
|
||||||
|
|
||||||
|
|
||||||
### <Operation> reduce(const Dimensions& new_dims, const Reducer& reducer)
|
### <Operation> reduce(const Dimensions& new_dims, const Reducer& reducer)
|
||||||
|
|
||||||
Reduce a tensor using a user-defined reduction operator. See ```SumReducer```
|
Reduce a tensor using a user-defined reduction operator. See ```SumReducer```
|
||||||
in TensorFunctors.h for information on how to implement a reduction operator.
|
in TensorFunctors.h for information on how to implement a reduction operator.
|
||||||
@ -1170,7 +1170,7 @@ in TensorFunctors.h for information on how to implement a reduction operator.
|
|||||||
|
|
||||||
## Convolutions
|
## Convolutions
|
||||||
|
|
||||||
### <Operation> convolve(const Kernel& kernel, const Dimensions& dims)
|
### <Operation> convolve(const Kernel& kernel, const Dimensions& dims)
|
||||||
|
|
||||||
Returns a tensor that is the output of the convolution of the input tensor with the kernel,
|
Returns a tensor that is the output of the convolution of the input tensor with the kernel,
|
||||||
along the specified dimensions of the input tensor. The dimension size for dimensions of the output tensor
|
along the specified dimensions of the input tensor. The dimension size for dimensions of the output tensor
|
||||||
@ -1213,7 +1213,7 @@ These operations return a Tensor with different dimensions than the original
|
|||||||
Tensor. They can be used to access slices of tensors, see them with different
|
Tensor. They can be used to access slices of tensors, see them with different
|
||||||
dimensions, or pad tensors with additional data.
|
dimensions, or pad tensors with additional data.
|
||||||
|
|
||||||
### <Operation> reshape(const Dimensions& new_dims)
|
### <Operation> reshape(const Dimensions& new_dims)
|
||||||
|
|
||||||
Returns a view of the input tensor that has been reshaped to the specified
|
Returns a view of the input tensor that has been reshaped to the specified
|
||||||
new dimensions. The argument new_dims is an array of Index values. The
|
new dimensions. The argument new_dims is an array of Index values. The
|
||||||
@ -1292,7 +1292,7 @@ Note that "b" itself was not reshaped but that instead the assignment is done to
|
|||||||
the reshape view of b.
|
the reshape view of b.
|
||||||
|
|
||||||
|
|
||||||
### <Operation> shuffle(const Shuffle& shuffle)
|
### <Operation> shuffle(const Shuffle& shuffle)
|
||||||
|
|
||||||
Returns a copy of the input tensor whose dimensions have been
|
Returns a copy of the input tensor whose dimensions have been
|
||||||
reordered according to the specified permutation. The argument shuffle
|
reordered according to the specified permutation. The argument shuffle
|
||||||
@ -1333,7 +1333,7 @@ Let's rewrite the previous example to take advantage of this feature:
|
|||||||
output.shuffle({2, 0, 1}) = input;
|
output.shuffle({2, 0, 1}) = input;
|
||||||
|
|
||||||
|
|
||||||
### <Operation> stride(const Strides& strides)
|
### <Operation> stride(const Strides& strides)
|
||||||
|
|
||||||
Returns a view of the input tensor that strides (skips stride-1
|
Returns a view of the input tensor that strides (skips stride-1
|
||||||
elements) along each of the dimensions. The argument strides is an
|
elements) along each of the dimensions. The argument strides is an
|
||||||
@ -1359,7 +1359,7 @@ It is possible to assign a tensor to a stride:
|
|||||||
output.stride({2, 3, 4}) = input;
|
output.stride({2, 3, 4}) = input;
|
||||||
|
|
||||||
|
|
||||||
### <Operation> slice(const StartIndices& offsets, const Sizes& extents)
|
### <Operation> slice(const StartIndices& offsets, const Sizes& extents)
|
||||||
|
|
||||||
Returns a sub-tensor of the given tensor. For each dimension i, the slice is
|
Returns a sub-tensor of the given tensor. For each dimension i, the slice is
|
||||||
made of the coefficients stored between offset[i] and offset[i] + extents[i] in
|
made of the coefficients stored between offset[i] and offset[i] + extents[i] in
|
||||||
@ -1385,7 +1385,7 @@ the input tensor.
|
|||||||
600 700
|
600 700
|
||||||
|
|
||||||
|
|
||||||
### <Operation> chip(const Index offset, const Index dim)
|
### <Operation> chip(const Index offset, const Index dim)
|
||||||
|
|
||||||
A chip is a special kind of slice. It is the subtensor at the given offset in
|
A chip is a special kind of slice. It is the subtensor at the given offset in
|
||||||
the dimension dim. The returned tensor has one fewer dimension than the input
|
the dimension dim. The returned tensor has one fewer dimension than the input
|
||||||
@ -1436,7 +1436,7 @@ lvalue. For example:
|
|||||||
0 0 0
|
0 0 0
|
||||||
|
|
||||||
|
|
||||||
### <Operation> reverse(const ReverseDimensions& reverse)
|
### <Operation> reverse(const ReverseDimensions& reverse)
|
||||||
|
|
||||||
Returns a view of the input tensor that reverses the order of the coefficients
|
Returns a view of the input tensor that reverses the order of the coefficients
|
||||||
along a subset of the dimensions. The argument reverse is an array of boolean
|
along a subset of the dimensions. The argument reverse is an array of boolean
|
||||||
@ -1466,7 +1466,7 @@ of a 2D tensor:
|
|||||||
0 100 200
|
0 100 200
|
||||||
|
|
||||||
|
|
||||||
### <Operation> broadcast(const Broadcast& broadcast)
|
### <Operation> broadcast(const Broadcast& broadcast)
|
||||||
|
|
||||||
Returns a view of the input tensor in which the input is replicated one to many
|
Returns a view of the input tensor in which the input is replicated one to many
|
||||||
times.
|
times.
|
||||||
@ -1490,11 +1490,11 @@ made in each of the dimensions.
|
|||||||
0 100 200 0 100 200
|
0 100 200 0 100 200
|
||||||
300 400 500 300 400 500
|
300 400 500 300 400 500
|
||||||
|
|
||||||
### <Operation> concatenate(const OtherDerived& other, Axis axis)
|
### <Operation> concatenate(const OtherDerived& other, Axis axis)
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
### <Operation> pad(const PaddingDimensions& padding)
|
### <Operation> pad(const PaddingDimensions& padding)
|
||||||
|
|
||||||
Returns a view of the input tensor in which the input is padded with zeros.
|
Returns a view of the input tensor in which the input is padded with zeros.
|
||||||
|
|
||||||
@ -1519,7 +1519,7 @@ Returns a view of the input tensor in which the input is padded with zeros.
|
|||||||
0 0 0 0
|
0 0 0 0
|
||||||
|
|
||||||
|
|
||||||
### <Operation> extract_patches(const PatchDims& patch_dims)
|
### <Operation> extract_patches(const PatchDims& patch_dims)
|
||||||
|
|
||||||
Returns a tensor of coefficient patches extracted from the input tensor, where
|
Returns a tensor of coefficient patches extracted from the input tensor, where
|
||||||
each patch is of dimension specified by 'patch_dims'. The returned tensor has
|
each patch is of dimension specified by 'patch_dims'. The returned tensor has
|
||||||
@ -1606,7 +1606,7 @@ patch index: 5
|
|||||||
6 7
|
6 7
|
||||||
10 11
|
10 11
|
||||||
|
|
||||||
### <Operation> extract_image_patches(const Index patch_rows, const Index patch_cols,
|
### <Operation> extract_image_patches(const Index patch_rows, const Index patch_cols,
|
||||||
const Index row_stride, const Index col_stride,
|
const Index row_stride, const Index col_stride,
|
||||||
const PaddingType padding_type)
|
const PaddingType padding_type)
|
||||||
|
|
||||||
@ -1663,7 +1663,7 @@ sizes:
|
|||||||
|
|
||||||
## Special Operations
|
## Special Operations
|
||||||
|
|
||||||
### <Operation> cast<T>()
|
### <Operation> cast<T>()
|
||||||
|
|
||||||
Returns a tensor of type T with the same dimensions as the original tensor.
|
Returns a tensor of type T with the same dimensions as the original tensor.
|
||||||
The returned tensor contains the values of the original tensor converted to
|
The returned tensor contains the values of the original tensor converted to
|
||||||
@ -1692,7 +1692,7 @@ but you can easily cast the tensors to floats to do the division:
|
|||||||
1 2 2
|
1 2 2
|
||||||
|
|
||||||
|
|
||||||
### <Operation> eval()
|
### <Operation> eval()
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
|
|
||||||
@ -1701,7 +1701,7 @@ TODO
|
|||||||
|
|
||||||
Scalar values are often represented by tensors of size 1 and rank 1. It would be
|
Scalar values are often represented by tensors of size 1 and rank 1. It would be
|
||||||
more logical and user friendly to use tensors of rank 0 instead. For example
|
more logical and user friendly to use tensors of rank 0 instead. For example
|
||||||
Tensor<T, N>::maximum() currently returns a Tensor<T, 1>. Similarly, the inner
|
Tensor<T, N>::maximum() currently returns a Tensor<T, 1>. Similarly, the inner
|
||||||
product of 2 1d tensors (through contractions) returns a 1d tensor. In the
|
product of 2 1d tensors (through contractions) returns a 1d tensor. In the
|
||||||
future these operations might be updated to return 0d tensors instead.
|
future these operations might be updated to return 0d tensors instead.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user