UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NNETypes.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "UObject/Class.h"
6
7#include "NNETypes.generated.h"
8
14UENUM()
16{
17 None,
18 Char,
19 Boolean,
20 Half,
21 Float,
22 Double,
23 Int8,
24 Int16,
25 Int32,
26 Int64,
27 UInt8,
28 UInt16,
29 UInt32,
30 UInt64,
31 Complex64,
34};
35
36namespace UE::NNE
37{
45
52 {
53 public:
57 constexpr static int32 MaxRank = 8;
58
59 private:
61
62 public:
67
74
82
88 inline TConstArrayView<int32> GetData() const { return Data; };
89
95 inline int32 Rank() const { return Data.Num(); }
96
102 NNE_API bool IsConcrete() const;
103
111
119
126 };
127
134 {
135 public:
140
141 private:
143
144 public:
148 FTensorShape() = default;
149
155
163
173
179 inline TConstArrayView<uint32> GetData() const { return Data; };
180
186 inline int32 Rank() const { return Data.Num(); }
187
193 NNE_API uint64 Volume() const;
194
203
210 NNE_API bool operator==(const FTensorShape& OtherShape) const;
211
218 NNE_API bool operator!=(const FTensorShape& OtherShape) const;
219
225 };
226
234 {
235 private:
236 FString Name;
237 ENNETensorDataType DataType;
239
240 FTensorDesc() = default;
241
242 public:
251 static NNE_API FTensorDesc Make(const FString& Name, const FSymbolicTensorShape& Shape, ENNETensorDataType DataType);
252
258 inline const FString& GetName() const { return Name; }
259
265 inline ENNETensorDataType GetDataType() const { return DataType; }
266
272 inline uint32 GetElementByteSize() const { return GetTensorDataTypeSizeInBytes(DataType); }
273
279 inline const FSymbolicTensorShape& GetShape() const { return Shape; }
280 };
281
282} // namespace UE::NNE
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ENNETensorDataType
Definition NNETypes.h:16
@ Float
32-bit floating number
@ Boolean
Boolean type.
@ Int16
16-bit signed integer
@ None
For empty tensors.
@ Int8
8-bit signed integer
@ UInt16
16-bit unsigned integer
@ Char
Character type.
@ UInt64
64-bit unsigned integer
@ UInt8
8-bit unsigned integer
@ Int32
32-bit signed integer
@ Half
16-bit floating number
@ BFloat16
16-bit floating number
@ Double
64-bit floating number
@ Complex64
64-bit Complex Number
@ UInt32
32-bit unsigned integer
@ Complex128
128-bit Complex Number
@ Int64
64-bit signed integer
#define UENUM(...)
Definition ObjectMacros.h:749
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Array.h:670
Definition NNETypes.h:52
TConstArrayView< int32 > GetData() const
Definition NNETypes.h:88
NNE_API bool IsConcrete() const
Definition NNETypes.cpp:30
int32 Rank() const
Definition NNETypes.h:95
static constexpr int32 MaxRank
Definition NNETypes.h:57
NNE_API void operator=(const FSymbolicTensorShape &OtherShape)
Definition NNETypes.cpp:49
NNE_API bool operator!=(const FSymbolicTensorShape &OtherShape) const
Definition NNETypes.cpp:47
NNE_API bool operator==(const FSymbolicTensorShape &OtherShape) const
Definition NNETypes.cpp:42
static NNE_API FSymbolicTensorShape Make(TConstArrayView< int32 > Data)
Definition NNETypes.cpp:55
FSymbolicTensorShape(const FSymbolicTensorShape &OtherShape)=default
Definition NNETypes.h:234
ENNETensorDataType GetDataType() const
Definition NNETypes.h:265
const FString & GetName() const
Definition NNETypes.h:258
uint32 GetElementByteSize() const
Definition NNETypes.h:272
const FSymbolicTensorShape & GetShape() const
Definition NNETypes.h:279
static NNE_API FTensorDesc Make(const FString &Name, const FSymbolicTensorShape &Shape, ENNETensorDataType DataType)
Definition NNETypes.cpp:161
Definition NNETypes.h:134
NNE_API void operator=(const FTensorShape &OtherShape)
Definition NNETypes.cpp:99
TConstArrayView< uint32 > GetData() const
Definition NNETypes.h:179
NNE_API bool operator==(const FTensorShape &OtherShape) const
Definition NNETypes.cpp:92
NNE_API uint64 Volume() const
Definition NNETypes.cpp:64
NNE_API bool operator!=(const FTensorShape &OtherShape) const
Definition NNETypes.cpp:97
static constexpr int32 MaxRank
Definition NNETypes.h:139
static NNE_API FTensorShape Make(TConstArrayView< uint32 > Data)
Definition NNETypes.cpp:105
int32 Rank() const
Definition NNETypes.h:186
NNE_API bool IsCompatibleWith(const FSymbolicTensorShape &SymbolicShape) const
Definition NNETypes.cpp:76
static NNE_API FTensorShape MakeFromSymbolic(const FSymbolicTensorShape &SymbolicShape)
Definition NNETypes.cpp:114
FTensorShape(const FTensorShape &OtherShape)=default
Definition NNE.cpp:12
int32 GetTensorDataTypeSizeInBytes(ENNETensorDataType InType)
Definition NNETypes.cpp:125