PyTaco Data Type Object
- class pytaco.dtype
A tensor contains elements describe by this dtype object.
PyTaco currently does not provide a way to construct your own data types but provides several common data types for users.
See also
as_np_dtype
Convert to NumPy dtype
Notes
PyTaco exports the following data types:
pytaco.bool
- A True or False value.pytaco.int8
- An 8 bit signed integer.pytaco.int16
- A 16 bit signed integer.pytaco.int32
- A 32 bit signed integer.pytaco.int64
- A 64 bit signed integer.pytaco.uint8
- An 8 bit unsigned integer.pytaco.uint16
- A 16 bit unsigned integer.pytaco.uint32
- A 32 bit unsigned integer.pytaco.uint64
- A 64 bit unsigned integer.pytaco.float32
orpytaco.float
- A 32 bit floating point number.pytaco.float64
orpytaco.double
- A 64 bit floating point number.PyTaco also overrides the equality operator of the data type class so users can compare types using == and != to check if they are the same.
Examples
>>> import pytaco as pt >>> pt.int32.is_uint() False >>> pt.uint32.is_int() False >>> pt.float32 == pt.float64 False >>> pt.bool != pt.int64 True >>> pt.int8 pytaco.int8_t
Methods
is_bool
(self)Returns True if the data type is a boolean type and False otherwise.
is_uint
(self)Returns True if the data type is an unsigned integer and False otherwise.
is_int
(self)Returns True if the data type is a signed integer and False otherwise.
is_float
(self)Returns True if the data type is a float or double and False otherwise.