Draw data as a multi-dimension array (similar to python) according to shape.
More...
#include <tensor.hpp>
|
| PrettyTensor (std::vector< uint16_t > datalimit) |
|
void | print (std::ostream &out, T *arr, std::vector< uint8_t > shape) |
|
|
std::vector< uint16_t > | datalimit_ |
| Number of elements to show for each dimension. More...
|
|
|
void | print_helper (std::ostream &out, const std::vector< uint8_t > &shape, T *arr, uint8_t rank) |
|
template<typename T>
struct PrettyTensor< T >
Draw data as a multi-dimension array (similar to python) according to shape.
tensor.hpp dbg
Purpose: Draw tensor data in python-array format
◆ PrettyTensor()
Datalimit represents the maximum number of elements to print for each dimension corresponding to datalimit's index For example: given datalimit={5, 4, 3, 2}, print will only display at most 5 elements of the first dimension, at most 4 of the second, etc. beyond the first four dimensions, printing will display as many elements as there are
◆ print()
template<typename T >
void PrettyTensor< T >::print |
( |
std::ostream & |
out, |
|
|
T * |
arr, |
|
|
std::vector< uint8_t > |
shape |
|
) |
| |
|
inline |
Given the output stream, flattened tensor data, and the shape, wrap square brackets around each dimension in the tensor and stream to out For example: given arr={1, 2, 3, 4}, shape={2, 2}, print will stream [[1, 2], [3, 4]] to out
◆ print_helper()
template<typename T >
void PrettyTensor< T >::print_helper |
( |
std::ostream & |
out, |
|
|
const std::vector< uint8_t > & |
shape, |
|
|
T * |
arr, |
|
|
uint8_t |
rank |
|
) |
| |
|
inlineprivate |
◆ datalimit_
Number of elements to show for each dimension.
The documentation for this struct was generated from the following file: