get_user_data

Applicability

Product

Supported

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

x

Atlas training product

x

Function Description

Obtains the user-defined data.

Prototype

1
get_user_data(self, size: int , offset: int = 0) -> bytearray

Parameters

Parameter

Input/Output

Description

size

Input

Length of the user data. Value range: [0, 64]

offset

Input

Offset of the user data, which must comply with the following restriction:

[0, 64), size+offset<=64

Returns

User-defined data, which is of the bytearray type

Exception Handling

None

Constraints

If no value is passed to offset, the default value 0 is used. The returned type is bytearray. You need to perform reverse parsing based on the defined structure.

  • The string type is parsed using byte_array.decode("utf-8").
  • The int type can be parsed using int.from_bytes(byte_array, byteorder='big'), and byteorder can be set based on the environment.
  • The float type can be parsed using struct.unpack('f', byte_array)[0].