#include <blace_index.h>
Struct to represent indices of a tensor along one dimension. This mirrors a subset of https://pytorch.org/cppdocs/notes/tensor_indexing.html.
◆ BlaceIndex() [1/4]
blace::ml_core::BlaceIndex::BlaceIndex |
( |
| ) |
|
|
inline |
Constructs an empty index.
◆ BlaceIndex() [2/4]
blace::ml_core::BlaceIndex::BlaceIndex |
( |
int64_t |
integer | ) |
|
|
inline |
Selects one entry along dimension.
- Parameters
-
integer | The entry to select. |
◆ BlaceIndex() [3/4]
Slices a subset of a dimension.
- Parameters
-
◆ BlaceIndex() [4/4]
blace::ml_core::BlaceIndex::BlaceIndex |
( |
blace::ops::OpP |
tensor | ) |
|
|
inline |
Uses an node operator to select values from the input tensor. This is the lazy evaluation equivalent of tensor[torch.tensor([1, 2])].
- Parameters
-
◆ getNodeOp()
blace::ops::OpP blace::ml_core::BlaceIndex::getNodeOp |
( |
| ) |
|
Get the node operator.
- Returns
◆ getSlice()
◆ getType()
BlaceIndexType blace::ml_core::BlaceIndex::getType |
( |
| ) |
|
Get the type of the index.
- Returns
◆ integer()
int64_t blace::ml_core::BlaceIndex::integer |
( |
| ) |
const |
Return the stored integer.
- Returns
◆ is_integer()
bool blace::ml_core::BlaceIndex::is_integer |
( |
| ) |
const |
Check if type is integer.
- Returns
◆ is_node_op()
bool blace::ml_core::BlaceIndex::is_node_op |
( |
| ) |
const |
Check if type is node op.
- Returns
◆ is_none()
bool blace::ml_core::BlaceIndex::is_none |
( |
| ) |
const |
Check if type is none.
- Returns
◆ is_slice()
bool blace::ml_core::BlaceIndex::is_slice |
( |
| ) |
const |
Check if type is slice.
- Returns
◆ node_op()
const blace::ops::OpP & blace::ml_core::BlaceIndex::node_op |
( |
| ) |
const |
Return the operator.
- Returns
◆ operator==()
bool blace::ml_core::BlaceIndex::operator== |
( |
const BlaceIndex & |
rhs | ) |
const |
Equality operator.
- Parameters
-
- Returns
◆ slice()
Return the slice.
- Returns