/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/tensor_shape.hpp Source File

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/tensor_shape.hpp Source File#

2 min read time

Applies to Linux

rocCV: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-roccv/checkouts/latest/include/core/tensor_shape.hpp Source File
tensor_shape.hpp
Go to the documentation of this file.
1 
23 #pragma once
24 
25 #include <span>
26 
27 #include "tensor_layout.hpp"
28 
29 namespace roccv {
34 class TensorShape {
35  public:
36  TensorShape() = delete;
37 
50  const std::span<const int64_t> shape);
52  const std::initializer_list<const int64_t> shape);
53 
59  const TensorLayout &layout() const;
60 
66  int size() const;
67 
68  // Operators
69  int64_t operator[](int32_t i) const;
71  bool operator==(const TensorShape &rhs) const;
72  bool operator!=(const TensorShape &rhs) const;
73 
74  private:
75  std::array<int64_t, ROCCV_TENSOR_MAX_RANK> m_shape;
76  TensorLayout m_layout;
77  size_t m_size;
78 };
79 } // namespace roccv
TensorLayout class.
Definition: tensor_layout.hpp:57
TensorShape class.
Definition: tensor_shape.hpp:34
int64_t operator[](int32_t i) const
bool operator==(const TensorShape &rhs) const
int size() const
Returns the size (total number of elements) of the tensor.
TensorShape & operator=(const TensorShape &other)
const TensorLayout & layout() const
Retrieves the layout of the tensor.
TensorShape(const TensorLayout &layout, const std::span< const int64_t > shape)
Construct a new Tensor Shape object.
TensorShape(const TensorLayout &layout, const std::initializer_list< const int64_t > shape)
bool operator!=(const TensorShape &rhs) const
Definition: strided_data_wrap.hpp:33