Declaration
struct simaai::neat::Tensor { ... }
Public Member Functions Index
Private Member Functions Index
Public Member Attributes Index
Private Static Functions Index
| static std::size_t | dtype_bytes (simaai::neat::TensorDType dtype) |
|
|
|
Definition at line 235 of file TensorCore.h.
Public Member Functions
channels()
| int simaai::neat::Tensor::channels () |
|
clone()
| Tensor simaai::neat::Tensor::clone () |
|
contiguous()
| Tensor simaai::neat::Tensor::contiguous () |
|
copy_dense_bytes_tight()
| std::vector<uint8_t> simaai::neat::Tensor::copy_dense_bytes_tight () |
|
copy_dense_bytes_tight_to()
| bool simaai::neat::Tensor::copy_dense_bytes_tight_to (uint8_t * dst, std::size_t dst_size) |
|
copy_i420_contiguous()
| std::vector<uint8_t> simaai::neat::Tensor::copy_i420_contiguous () |
|
copy_i420_contiguous_to()
| bool simaai::neat::Tensor::copy_i420_contiguous_to (uint8_t * dst, std::size_t dst_size) |
|
copy_nv12_contiguous()
| std::vector<uint8_t> simaai::neat::Tensor::copy_nv12_contiguous () |
|
copy_nv12_contiguous_to()
| bool simaai::neat::Tensor::copy_nv12_contiguous_to (uint8_t * dst, std::size_t dst_size) |
|
copy_payload_bytes()
| std::vector<uint8_t> simaai::neat::Tensor::copy_payload_bytes () |
|
copy_payload_bytes_to()
| bool simaai::neat::Tensor::copy_payload_bytes_to (uint8_t * dst, std::size_t dst_size) |
|
cpu()
| Tensor simaai::neat::Tensor::cpu () |
|
cvu()
| Tensor simaai::neat::Tensor::cvu () |
|
data_ptr()
template <typename T>
| T* simaai::neat::Tensor::data_ptr () |
|
inline
|
Definition at line 329 of file TensorCore.h.
331 throw std::runtime_error("Tensor::data_ptr: tensor is read-only");
332 }
333 return const_cast<T*>(const_data_ptr<T>());
334 }
data_ptr()
template <typename T>
| const T* simaai::neat::Tensor::data_ptr () |
|
inline
|
Definition at line 336 of file TensorCore.h.
337 return const_data_ptr<T>();
338 }
debug_string()
| std::string simaai::neat::Tensor::debug_string () |
|
dense_bytes_tight()
| std::size_t simaai::neat::Tensor::dense_bytes_tight () |
|
has_plane()
| bool simaai::neat::Tensor::has_plane (PlaneRole role) |
|
inline
noexcept
|
height()
| int simaai::neat::Tensor::height () |
|
i420_required_bytes()
| std::size_t simaai::neat::Tensor::i420_required_bytes () |
|
image_format()
| std::optional<ImageSpec::PixelFormat> simaai::neat::Tensor::image_format () |
|
is_composite()
| bool simaai::neat::Tensor::is_composite () |
|
inline
|
is_contiguous()
| bool simaai::neat::Tensor::is_contiguous () |
|
inline
|
Definition at line 254 of file TensorCore.h.
256 return true;
258 return true;
259 std::size_t elem = dtype_bytes(dtype);
260 if (elem == 0)
261 return false;
262 std::int64_t expected = static_cast<std::int64_t>(elem);
263 for (int i = static_cast<int>(shape.size()) - 1; i >= 0; --i) {
265 return false;
266 expected *= shape[static_cast<size_t>(i)];
267 }
268 return true;
269 }
is_dense()
| bool simaai::neat::Tensor::is_dense () |
|
inline
|
is_i420()
| bool simaai::neat::Tensor::is_i420 () |
|
is_nv12()
| bool simaai::neat::Tensor::is_nv12 () |
|
map()
| Mapping simaai::neat::Tensor::map (MapMode mode) |
|
inline
|
Definition at line 290 of file TensorCore.h.
292 throw std::runtime_error("Tensor::map: tensor is read-only");
293 }
295 return {};
298 return base;
302 }
307 }
308 }
309#if defined(NEAT_VALIDATE_ON_MAP)
310 std::string err;
312 throw std::runtime_error("Tensor::map: " + err);
313 }
314#endif
315 return out;
316 }
map_i420_read()
| std::optional<I420Mapped> simaai::neat::Tensor::map_i420_read () |
|
map_nv12_read()
| std::optional<Nv12Mapped> simaai::neat::Tensor::map_nv12_read () |
|
map_read()
| Mapping simaai::neat::Tensor::map_read () |
|
inline
|
map_write()
| Mapping simaai::neat::Tensor::map_write () |
|
inline
|
mla()
| Tensor simaai::neat::Tensor::mla (bool force=false) |
|
nv12_required_bytes()
| std::size_t simaai::neat::Tensor::nv12_required_bytes () |
|
plane()
| const Plane& simaai::neat::Tensor::plane (PlaneRole role) |
|
inline
|
Definition at line 283 of file TensorCore.h.
285 if (!found)
286 throw std::runtime_error("Tensor::plane: plane not found");
287 return *found;
288 }
to()
| Tensor simaai::neat::Tensor::to (Device target) |
|
to_cpu_if_needed()
| Tensor simaai::neat::Tensor::to_cpu_if_needed () |
|
try_plane()
| const Plane* simaai::neat::Tensor::try_plane (PlaneRole role) |
|
inline
noexcept
|
Definition at line 271 of file TensorCore.h.
275 }
276 return nullptr;
277 }
validate()
| bool simaai::neat::Tensor::validate (std::string * err) |
|
view()
view_read()
| Mapping simaai::neat::Tensor::view_read () |
|
inline
|
width()
| int simaai::neat::Tensor::width () |
|
Private Member Functions
const_data_ptr()
template <typename T>
| const T* simaai::neat::Tensor::const_data_ptr () |
|
inline
|
Definition at line 384 of file TensorCore.h.
384 template <typename T> const T* const_data_ptr() const {
386 throw std::runtime_error("Tensor::data_ptr: tensor is not on CPU");
387 }
389 throw std::runtime_error("Tensor::data_ptr: tensor is composite");
390 }
392 throw std::runtime_error("Tensor::data_ptr: call cpu().contiguous() first");
393 }
395 throw std::runtime_error("Tensor::data_ptr: tensor storage is not mappable");
396 }
397 return reinterpret_cast<const T*>(static_cast<const uint8_t*>(storage->data) + byte_offset);
398 }
Public Member Attributes
byte_offset
| int64_t simaai::neat::Tensor::byte_offset = 0 |
|
device
| Device simaai::neat::Tensor::device {} |
|
dtype
layout
planes
| std::vector<Plane> simaai::neat::Tensor::planes |
|
read_only
| bool simaai::neat::Tensor::read_only = true |
|
semantic
| Semantic simaai::neat::Tensor::semantic {} |
|
shape
| std::vector<int64_t> simaai::neat::Tensor::shape |
|
storage
| std::shared_ptr<Storage> simaai::neat::Tensor::storage |
|
strides_bytes
| std::vector<int64_t> simaai::neat::Tensor::strides_bytes |
|
Private Static Functions
dtype_bytes()
Definition at line 400 of file TensorCore.h.
404 return 1;
408 return 2;
411 return 4;
413 return 8;
414 }
415 return 0;
416 }
The documentation for this struct was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.1.