Data types
shape
-
struct migraphx::internal::shape
Public Types
-
enum type_t
Values:
-
enumerator bool_type
-
enumerator half_type
-
enumerator float_type
-
enumerator double_type
-
enumerator uint8_type
-
enumerator int8_type
-
enumerator uint16_type
-
enumerator int16_type
-
enumerator int32_type
-
enumerator int64_type
-
enumerator uint32_type
-
enumerator uint64_type
-
enumerator tuple_type
-
enumerator bool_type
Public Functions
-
shape()
-
const std::vector<std::size_t> &lens() const
-
const std::vector<std::size_t> &strides() const
-
std::size_t elements() const
-
std::size_t bytes() const
-
std::size_t type_size() const
-
std::size_t index(std::initializer_list<std::size_t> l) const
Map multiple indices to space index.
-
std::size_t index(const std::vector<std::size_t> &l) const
Map multiple indices to space index.
-
template<class Iterator>
inline std::size_t index(Iterator start, Iterator last) const Map multiple indices from a range of iterator to a space index.
-
std::size_t index(std::size_t i) const
Map element index to space index.
-
std::vector<std::size_t> multi(std::size_t i) const
-
void multi_copy(std::size_t i, std::size_t *start, const std::size_t *end) const
-
bool packed() const
Returns true if the shape is packed with no padding.
-
bool transposed() const
Returns true is the shape has been transposed. That is the strides are not in descending order
-
bool broadcasted() const
Returns true if the shape is broadcasting a dimension. That is, one of the strides are zero.
-
bool standard() const
Returns true if the shape is in its standard format. That is, the shape is both packed and not transposed.
-
bool scalar() const
Returns true if all strides are equal to 0 (scalar tensor)
-
std::string type_string() const
Public Static Functions
-
static shape from_permutation(type_t t, const std::vector<std::size_t> &l, const std::vector<int64_t> &perm)
-
template<class Visitor, class TupleVisitor>
static inline void visit(type_t t, Visitor v, TupleVisitor tv)
Friends
- friend friend bool operator== (const shape &x, const shape &y)
- friend friend bool operator!= (const shape &x, const shape &y)
- friend friend std::ostream & operator<< (std::ostream &os, const shape &x)
-
template<class T, class = void>
struct get_type
-
template<class T>
struct get_type<double, T> : public std::integral_constant<type_t, double_type>
-
template<class T>
struct get_type<float, T> : public std::integral_constant<type_t, float_type>
-
template<class T>
struct get_type<int16_t, T> : public std::integral_constant<type_t, int16_type>
-
template<class T>
struct get_type<int32_t, T> : public std::integral_constant<type_t, int32_type>
-
template<class T>
struct get_type<int64_t, T> : public std::integral_constant<type_t, int64_type>
-
template<class T>
struct get_type<uint16_t, T> : public std::integral_constant<type_t, uint16_type>
-
template<class T>
struct get_type<uint32_t, T> : public std::integral_constant<type_t, uint32_type>
-
template<class T>
struct get_type<uint64_t, T> : public std::integral_constant<type_t, uint64_type>
-
template<class T>
struct get_type<uint8_t, T> : public std::integral_constant<type_t, uint8_type>
-
enum type_t
literal
-
struct migraphx::internal::literal : public migraphx::internal::raw_data<literal>
Represents a raw literal.
This stores the literal has a raw buffer that is owned by this class
Public Functions
-
inline literal()
-
template<class U, class T = deduce<U>, shape::type_t ShapeType = shape::get_type<T>{}>
inline literal(U x)
-
template<class T, long PrivateRequires__LINE__ = __LINE__, typename std::enable_if<(PrivateRequires__LINE__ == __LINE__ && (migraphx::and_<sizeof(T) == 1>{})), int>::type = 0>
inline literal(const shape &s, T *x)
-
inline bool empty() const
Whether data is available.
-
inline const char *data() const
Provides a raw pointer to the data.
-
inline literal()
argument
-
struct migraphx::internal::argument : public migraphx::internal::raw_data<argument>
Arguments passed to instructions.
An
argumentcan represent a raw buffer of data that either be referenced from another element or it can be owned by the argument.Public Functions
-
argument() = default
-
template<class F, long PrivateRequires__LINE__ = __LINE__, typename std::enable_if<(PrivateRequires__LINE__ == __LINE__ && (migraphx::and_<std::is_pointer<decltype(std::declval<F>()())>{}>{})), int>::type = 0>
inline argument(shape s, F d)
-
char *data() const
Provides a raw pointer to the data.
-
bool empty() const
Whether data is available.
Make copy of the argument that is always sharing the data.
-
argument() = default
raw_data
-
template<class Derived>
struct migraphx::internal::raw_data : public migraphx::internal::raw_data_base Provides a base class for common operations with raw buffer.
For classes that handle a raw buffer of data, this will provide common operations such as equals, printing, and visitors. To use this class the derived class needs to provide a
data()method to retrieve a raw pointer to the data, andget_shapemethod that provides the shape of the data.Public Functions
-
template<class Visitor>
inline void visit_at(Visitor v, std::size_t n = 0) const Visits a single data element at a certain index.
- Parameters
v – A function which will be called with the type of data
n – The index to read from
-
template<class Visitor, class TupleVisitor>
inline void visit(Visitor v, TupleVisitor tv) const
-
template<class Visitor>
inline void visit(Visitor v) const Visits the data.
This will call the visitor function with a
tensor_view<T>based on the shape of the data.- Parameters
v – A function to be called with
tensor_view<T>
-
inline bool single() const
Returns true if the raw data is only one element.
-
template<class T>
inline T at(std::size_t n = 0) const Retrieves a single element of data.
- Parameters
n – The index to retrieve the data from
- Template Parameters
T – The type of data to be retrieved
- Returns
The element as
T
-
template<class T>
inline tensor_view<T> get() const Get a tensor_view to the data.
-
inline std::string to_string() const
Friends
- template<class Stream> inline friend friend Stream & operator<< (Stream &os, const Derived &d)
-
struct auto_cast
Public Types
-
using is_data_ptr = bool_c<(std::is_void<T>{} or std::is_same<char, std::remove_cv_t<T>>{} or std::is_same<unsigned char, std::remove_cv_t<T>>{})>
-
using get_data_type = std::conditional_t<is_data_ptr<T>{}, float, T>
Public Functions
-
template<class T>
inline bool matches() const
-
using is_data_ptr = bool_c<(std::is_void<T>{} or std::is_same<char, std::remove_cv_t<T>>{} or std::is_same<unsigned char, std::remove_cv_t<T>>{})>
-
template<class Visitor>
Warning
doxygenfunction: Unable to resolve function “migraphx::internal::visit_all” with arguments None in doxygen xml output for project “proj” from directory: /code/AMDMIGraphX/build/doc/doxygen/xml. Potential matches:
- template<class T, class ...Ts> auto visit_all(T &&x, Ts&&... xs)
- template<class T> auto visit_all(const std::vector<T> &x)
tensor_view
-
template<class T>
struct migraphx::internal::tensor_view Public Types
-
using iterator = basic_iota_iterator<tensor_view_iterator_read<tensor_view<T>>, std::size_t>
-
using const_iterator = basic_iota_iterator<tensor_view_iterator_read<const tensor_view<T>>, std::size_t>
Public Functions
-
inline tensor_view()
-
inline bool empty() const
-
inline std::size_t size() const
-
template<class ...Ts, long PrivateRequires__LINE__ = __LINE__, typename std::enable_if<(PrivateRequires__LINE__ == __LINE__ && (migraphx::and_<std::is_integral<Ts>{}...>{})), int>::type = 0>
inline const T &operator()(Ts... xs) const
-
template<class ...Ts, long PrivateRequires__LINE__ = __LINE__, typename std::enable_if<(PrivateRequires__LINE__ == __LINE__ && (migraphx::and_<std::is_integral<Ts>{}...>{})), int>::type = 0>
inline T &operator()(Ts... xs)
-
template<class Iterator, long PrivateRequires__LINE__ = __LINE__, typename std::enable_if<(PrivateRequires__LINE__ == __LINE__ && (migraphx::and_<not std::is_integral<Iterator>{}>{})), int>::type = 0>
inline const T &operator()(Iterator start, Iterator last) const
-
template<class Iterator, long PrivateRequires__LINE__ = __LINE__, typename std::enable_if<(PrivateRequires__LINE__ == __LINE__ && (migraphx::and_<not std::is_integral<Iterator>{}>{})), int>::type = 0>
inline T &operator()(Iterator start, Iterator last)
-
inline const_iterator begin() const
-
inline const_iterator end() const
Friends
- inline friend friend std::ostream & operator<< (std::ostream &os, const tensor_view< T > &x)
-
using iterator = basic_iota_iterator<tensor_view_iterator_read<tensor_view<T>>, std::size_t>