Class UserBufferEncodingTfN

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class UserBufferEncodingTfN : public DlSystem::UserBufferEncoding

Subclassed by DlSystem::UserBufferEncodingTf8

Public Functions

template<typename T, typename U, typename std::enable_if<std::is_integral<T>::value && std::is_floating_point<U>::value, int>::type = 0>
UserBufferEncodingTfN(T stepFor0, U stepSize, uint8_t bWidth = 8)

An encoding type where each element is represented by tfN, which is an N-bit quantized value, which has an exact representation of 0.0.

Userbuffer size assumes tf N encoding for each element. (i.e., a tensor with dimensions (2,3) with a provided bitwidth of 16 will be represented by (2 * 3) * 2 = 12 bytes in memory).

UserBufferEncodingTfN(const UserBufferEncoding &ubEncoding)

Copy Constructor for UserBufferEncodingTfN.

An encoding type where each element is represented by tfN, which is an N-bit quantized value, which has an exact representation of 0.0

Userbuffer size assumes tf N encoding for each element. (i.e., a tensor with dimensions (2,3) with a provided bitwidth of 16 will be represented by (2 * 3) * 2 = 12 bytes in memory).

Parameters

otherHandle – the UserBufferEncodingTfN to copy

Returns

a handle to a newly constructed UserBufferEncodingTfN

UserBufferEncodingTfN(const UserBufferEncodingTfN &ubEncoding)

Copy Constructor for UserBufferEncodingTfN.

An encoding type where each element is represented by tfN, which is an N-bit quantized value, which has an exact representation of 0.0

Userbuffer size assumes tf N encoding for each element. (i.e., a tensor with dimensions (2,3) with a provided bitwidth of 16 will be represented by (2 * 3) * 2 = 12 bytes in memory).

Parameters

otherHandle – the UserBufferEncodingTfN to copy

Returns

a handle to a newly constructed UserBufferEncodingTfN

void setStepExactly0(uint64_t stepExactly0)

Sets the step value that represents 0.

Parameters
  • userBufferEncodingHandle[in] : Handle to access the encoding

  • stepExactly0[in] : The step value that represents 0

void setQuantizedStepSize(const float quantizedStepSize)

Sets the float value that each step represents.

Parameters
  • userBufferEncodingHandle[in] : Handle to access the encoding

  • quantizedStepSize[in] : The float value of each step size

uint64_t getStepExactly0() const

Retrieves the step that represents 0.0.

Parameters

userBufferEncodingHandle[in] : Handle to access the encoding

Returns

Step value

float getMin() const

Calculates the minimum floating point value that can be represented with this encoding.

Parameters

userBufferEncodingHandle[in] : Handle to access the encoding

Returns

Minimum representable floating point value

float getMax() const

Calculates the maximum floating point value that can be represented with this encoding.

Parameters

userBufferEncodingHandle[in] : Handle to access the encoding

Returns

Maximum representable floating point value

float getQuantizedStepSize() const

Retrieves the step size.

Parameters

userBufferEncodingHandle[in] : Handle to access the encoding

Returns

Step size

UserBufferEncoding(UserBufferEncoding &&other) noexcept

Public Static Functions

static ElementType_t getTypeFromWidth(uint8_t width)

Get the tfN type corresponding to a given bitwidth.

Parameters

width – bitwidth of tfN type

Returns

ElementType corresponding to a tfN of width bits