Class InferenceRequestInput

Inheritance Relationships

Base Type

Class Documentation

class InferenceRequestInput : public amdinfer::Serializable

Holds an inference request’s input data.

Public Functions

InferenceRequestInput()

Constructs a new InferenceRequestInput object.

InferenceRequestInput(void *data, std::vector<uint64_t> shape, DataType data_type, std::string name = "")

Construct a new InferenceRequestInput object.

Parameters
  • data – pointer to data

  • shape – shape of the data

  • data_type – type of the data

  • name – name to assign

void setData(void *buffer)

Sets the request’s data.

void setData(std::vector<std::byte> &&buffer)

Sets the request’s shared data.

bool sharedData() const

Checks if the stored data is shared.

void *getData() const

Gets a pointer to the request’s data.

inline const std::string &getName() const

Gets the input tensor’s name.

void setName(std::string name)

Sets the input tensor’s name.

inline const std::vector<uint64_t> &getShape() const

Gets the input tensor’s shape.

inline void setShape(std::initializer_list<uint64_t> shape)

Sets the tensor’s shape.

inline void setShape(const std::vector<uint64_t> &shape)

Sets the tensor’s shape.

inline void setShape(const std::vector<int32_t> &shape)

Sets the tensor’s shape.

inline DataType getDatatype() const

Gets the input tensor’s datatype.

void setDatatype(DataType type)

Set the tensor’s data type.

inline RequestParameters *getParameters() const

Gets the input tensor’s parameters.

inline void setParameters(RequestParametersPtr parameters)

Sets the input tensor’s parameters.

Parameters

parameters – pointer to parameters to assign

size_t getSize() const

Get the tensor’s size (number of elements)

virtual size_t serializeSize() const override

Returns the size of the serialized data.

Returns

size_t

virtual void serialize(std::byte *data_out) const override

Serializes the object to the provided memory address. There should be sufficient space to store the serialized object.

Parameters

data_out

virtual void deserialize(const std::byte *data_in) override

Deserializes the data at the provided memory address to initialize this object. If the memory cannot be deserialized, an exception is thrown.

Parameters

data_in – a pointer to the serialized data for this object type

Friends

inline friend std::ostream &operator<<(std::ostream &os, InferenceRequestInput const &my_class)

Provides an implementation to print the class with std::cout to an ostream.