Skip to content

Accera v1.2 Reference

accera.Scalar([element_type, value])

Constructs a scalar that holds a number.

Arguments

argument description type/default
element_type The element type. accera.ScalarType, default: accera.ScalarType.float32.
value An optional value. A number.

Examples

Construct a float32 scalar:

import accera as acc

X = acc.Scalar()

Construct a float32 scalar and initialize it:

Pi = acc.Scalar(value=3.14)

Construct integer scalars and perform arithmetic operations on them:

X = acc.Scalar(element_type=acc.ScalarType.int32)
Y = acc.Scalar(element_type=acc.ScalarType.int32)
Y.value = x + 2


Last update: 2023-04-17