1#  Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2#  See https://llvm.org/LICENSE.txt for license information.
3#  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5"""Supports the PyTACO API with the MLIR-PyTACO implementation.
6
7See http://tensor-compiler.org/ for TACO tensor compiler.
8
9This module exports the MLIR-PyTACO implementation through the language defined
10by PyTACO. In particular, it defines the function and type aliases and constants
11needed for the PyTACO API to support the execution of PyTACO programs using the
12MLIR-PyTACO implementation.
13"""
14
15from . import mlir_pytaco
16from . import mlir_pytaco_io
17
18# Functions defined by PyTACO API.
19ceil = mlir_pytaco.ceil
20floor = mlir_pytaco.floor
21get_index_vars = mlir_pytaco.get_index_vars
22from_array = mlir_pytaco.Tensor.from_array
23read = mlir_pytaco_io.read
24write = mlir_pytaco_io.write
25
26# Classes defined by PyTACO API.
27dtype = mlir_pytaco.DType
28mode_format = mlir_pytaco.ModeFormat
29mode_ordering = mlir_pytaco.ModeOrdering
30mode_format_pack = mlir_pytaco.ModeFormatPack
31format = mlir_pytaco.Format
32index_var = mlir_pytaco.IndexVar
33tensor = mlir_pytaco.Tensor
34index_expression = mlir_pytaco.IndexExpr
35access = mlir_pytaco.Access
36
37# Data type constants defined by PyTACO API.
38int8 = mlir_pytaco.DType(mlir_pytaco.Type.INT8)
39int16 = mlir_pytaco.DType(mlir_pytaco.Type.INT16)
40int32 = mlir_pytaco.DType(mlir_pytaco.Type.INT32)
41int64 = mlir_pytaco.DType(mlir_pytaco.Type.INT64)
42float16 = mlir_pytaco.DType(mlir_pytaco.Type.FLOAT16)
43float32 = mlir_pytaco.DType(mlir_pytaco.Type.FLOAT32)
44float64 = mlir_pytaco.DType(mlir_pytaco.Type.FLOAT64)
45complex64 = mlir_pytaco.DType(mlir_pytaco.Type.COMPLEX64)
46complex128 = mlir_pytaco.DType(mlir_pytaco.Type.COMPLEX128)
47
48# Storage format constants defined by the PyTACO API. In PyTACO, each storage
49# format constant has two aliasing names.
50compressed = mlir_pytaco.ModeFormat.COMPRESSED
51Compressed = mlir_pytaco.ModeFormat.COMPRESSED
52dense = mlir_pytaco.ModeFormat.DENSE
53Dense = mlir_pytaco.ModeFormat.DENSE
54