Skip to content

NevarokML: UNevarokMLSample API

The UNevarokMLSample class in NevarokML is designed to hold various types of values, including discrete, continuous, multi-discrete, multi-binary, and box values. It provides methods to get, set, and validate these values. Additionally, it supports stacking and serialization/deserialization of values.


Properties

  • _longArray (TArray<int64>): An array of int64 values used for discrete and multi-discrete values.
  • _floatArray (TArray<float>): An array of float values used for continuous and box values.
  • _byteArray (TArray<int8>): An array of int8 values used for multi-binary values.
  • _space (UNevarokMLSpace*): A reference to the associated space object.
  • _nneBinding (UE::NNECore::FTensorBindingCPU): An instance of the FTensorBindingCPU class used for NNE compatibility.

Methods

Sample Creation

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
static UNevarokMLSample* Sample(UNevarokMLSpace* owner);
Creates a new UNevarokMLSample object associated with the specified UNevarokMLSpace owner.

Getting Values

#include "Samples/NevarokMLSample.h"

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool GetDiscreteValue(int64& value);

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool GetContinuousValue(int index, float& value);

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool GetMultiDiscreteValue(const int index, int64& value);

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool GetMultiBinaryValue(int index, int& value);

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool GetBoxValue(FNevarokMLIndex2D index, float& value);
Retrieves the corresponding values from the UNevarokMLSample object.

Setting Values

#include "Samples/NevarokMLSample.h"

UFUNCTION(BlueprintCallable, Category = "NevarokML|Sample")
bool SetDiscreteValue(const int64 value);

UFUNCTION(BlueprintCallable, Category = "NevarokML|Sample")
bool SetMultiDiscreteValue(const int index, int64 value, const bool multicast);

UFUNCTION(BlueprintCallable, Category = "NevarokML|Sample")
bool SetMultiBinaryValue(const int index, int value, const bool multicast);

UFUNCTION(BlueprintCallable, Category = "NevarokML|Sample")
bool SetBoxValue(FNevarokMLIndex2D index, float value, const bool multicast);

UFUNCTION(BlueprintCallable, Category = "NevarokML|Sample")
bool SetContinuousValue(const int index, float value, const bool multicast);

Sets the corresponding values in the UNevarokMLSample object. By default, the multicast parameter is set to false. However, if you set multicast to true, all of the corresponding stack values will be set to the provided value.

Value Validation

#include "Samples/NevarokMLSample.h"

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool ValidateBoxValue(FNevarokMLIndex2D index) const;

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool ValidateDiscreteValue() const;

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool ValidateMultiDiscreteValue(const int index) const;

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool ValidateMultiBinaryValue(int index) const;

UFUNCTION(BlueprintPure, Category = "NevarokML|Sample")
bool ValidateContinuousValue(const int index) const;

Validates the corresponding values in the UNevarokMLSample object.

Stack Operations

#include "Samples/NevarokMLSample.h"

UFUNCTION(BlueprintCallable, Category = "NevarokML|Sample")
void StackShift();

UFUNCTION(BlueprintCallable, Category = "NevarokML|Sample")
void Clear();

Performs stack shifting and clearing operations on the UNevarokMLSample object.

Serialization/Deserialization

#include "Samples/NevarokMLSample.h"

void ToJson(const FString& field, const TSharedPtr<FJsonObject>& jsonObject) const;
void FromJson(const FString& field, const TSharedPtr<FJsonObject>& jsonObject);

void SerializeBox(const FString& field, const TSharedPtr<FJsonObject>& jsonObject) const;
void SerializeDiscrete(const FString& field, const TSharedPtr<FJsonObject>& jsonObject) const;
void SerializeMultiDiscrete(const FString& field, const TSharedPtr<FJsonObject>& jsonObject) const;
void SerializeMultiBinary(const FString& field, const TSharedPtr<FJsonObject>& jsonObject) const;

void DeserializeDiscrete(const FString& field, const TSharedPtr<FJsonObject>& jsonObject);
void DeserializeBox(const FString& field, const TSharedPtr<FJsonObject>& jsonObject);
void DeserializeMultiDiscrete(const FString& field,const TSharedPtr<FJsonObject>& jsonObject);
void DeserializeMultiBinary(const FString& field, const TSharedPtr<FJsonObject>& jsonObject);

Provides methods for serializing and deserializing the UNevarokMLSample object.