{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_HADDOCK hide, prune, not-home #-}

module MLIR.AST.Dialect.Generated.LinalgStructured where

import Prelude (Int, Double, Maybe(..), Bool(..), (++), (<$>), ($), (<>), Show)
import qualified Prelude
import Data.Int (Int64)
import qualified Data.Maybe
import Data.Array (Ix)
import qualified Data.Array.IArray as IArray
import qualified Data.ByteString as BS
import qualified Data.Map.Strict as M
import qualified Control.Monad

import MLIR.AST ( Attribute(..), Type(..), AbstractOperation(..), ResultTypes(..)
                , Location(..), Signedness(..), DenseElements(..)
                , NamedAttributes, Name
                , pattern NoAttrs )
import qualified MLIR.AST as AST
import MLIR.AST.Builder (Value, EndOfBlock, MonadBlockBuilder, RegionBuilderT)
import qualified MLIR.AST.Builder as AST
import qualified MLIR.AST.IStorableArray as AST
import qualified MLIR.AST.PatternUtil as PatternUtil
import qualified MLIR.AST.Dialect.Affine as Affine

-- * abs
-- $abs
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.abs@.
abs :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
abs :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
abs [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.abs"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * add
-- $add
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.add@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.add@.
add :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
add :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
add [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.add"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * batch_matmul
-- $batch_matmul
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.batch_matmul@.
batch_matmul :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matmul :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matmul [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.batch_matmul"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * batch_matmul_transpose_a
-- $batch_matmul_transpose_a
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.batch_matmul_transpose_a@.
batch_matmul_transpose_a :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matmul_transpose_a :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matmul_transpose_a [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.batch_matmul_transpose_a"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * batch_matmul_transpose_b
-- $batch_matmul_transpose_b
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.batch_matmul_transpose_b@.
batch_matmul_transpose_b :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matmul_transpose_b :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matmul_transpose_b [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.batch_matmul_transpose_b"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * batch_matvec
-- $batch_matvec
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.batch_matvec@.
batch_matvec :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matvec :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_matvec [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.batch_matvec"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * batch_mmt4d
-- $batch_mmt4d
-- Besides the outermost batch dimension has the same semantic as
-- linalg.batch_matmul, the differences from linalg.batch_matmul in the
-- non-batch dimensions are the same as linalg.mmt4d vs. linalg.matmul. See the
-- description of lingalg.mmt4d.

-- | A builder for @linalg.batch_mmt4d@.
batch_mmt4d :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_mmt4d :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_mmt4d [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.batch_mmt4d"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * batch_reduce_matmul
-- $batch_reduce_matmul
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.batch_reduce_matmul@.
batch_reduce_matmul :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_reduce_matmul :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_reduce_matmul [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.batch_reduce_matmul"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * batch_vecmat
-- $batch_vecmat
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.batch_vecmat@.
batch_vecmat :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_vecmat :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
batch_vecmat [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.batch_vecmat"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * broadcast
-- $broadcast
-- 
-- Broadcast the input into the given shape by adding @dimensions@.
-- 
-- Example:
-- @
--   %bcast = linalg.broadcast
--       ins(%input:tensor\<16xf32>)
--       outs(%init:tensor\<16x64xf32>)
--       dimensions = [1]
-- @
--   

-- * ceil
-- $ceil
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.ceil@.
ceil :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
ceil :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
ceil [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.ceil"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * contract
-- $contract
-- 
-- The semantics of contracting inputs @A@ and @B@ on top of @C@ to produce
-- output @D@ is given by
-- 
--   @D[H] = (SUM_{(I ∪ J) \ H} A[I] * B[J]) + C[H]@
-- 
-- where @I@, @J@, and @H@ are tuples of (pairwise distinct) dimension
-- identifiers - meant to range over valid indices - corresponding to the
-- results of the mandatory (projected permutation) @indexing_maps@ for @A@,
-- @B@ and @C@. @SUM_{dims}@ means reduce over all valid indices for the
-- dimensions in the set @dims@ (with @I@, @J@, and @K@ treated as _sets_ of
-- dim identifiers).
-- 
-- The iteration space consists of all dimensions in @I@, @J@ and @H@, i.e. the
-- domain of each of the @affine_map@s. Like for einsums, the iteration type of
-- each dim is inferred and is either:
-- 
-- - reduction: the dim is used to index into @A@ and @B@ but not @C@. Per the
--   above semantics, these dims will be contracted, i.e. reduced over.
-- 
-- - parallel: the dim is used to index into @C@ and at least one of @A@ and
--   @B@, and - deriving from matmul terminology - is either an \"M-like\" dim
--   (if used on @A@ and @C@), an \"N-like\" dim (if used on @B@ and @C@) or a
--   \"batch\"-dim (if used to index into @A@, @B@, and @C@).
-- 
-- For example, batch-matmul is given by @I = ⟨ b, m, k ⟩@, @J = ⟨ b, k, n ⟩@,
-- @H = ⟨ b, m, n ⟩@ (with @k@ as a contracting reduction-dimension while @m@,
-- @n@ and @b@ have parallel iteration-type) and gets represented as:
-- 
-- @
-- %D = linalg.contract
--     indexing_maps = [affine_map\<(batch, m, n, k) -> (batch, m, k)>,
--                      affine_map\<(batch, m, n, k) -> (batch, k, n)>,
--                      affine_map\<(batch, m, n, k) -> (batch, m, n)>]
--     ins(%A, %B: tensor\<?x?x?xf32>, tensor\<?x?x?xf32>)
--     outs(%C: tensor\<?x?x?xf32>) -> tensor\<?x?x?xf32>
-- @
-- 
-- Note that by permuting dims in the @affine_map@s\' results, accesses to
-- to the inputs and output can be arbitrarily transposed. Similarly, arbitrary
-- broadcasts can be achieved through leaving out dims on either input operand.
-- For example, the following is a variant of batch-matmul with a transposition
-- applied to @A@ while @B@\'s 2D-matrix gets broadcasted along the batch dim:
-- 
-- @
-- linalg.contract
--     indexing_maps = [affine_map\<(batch, m, n, k) -> (batch, k, m)>,
--                      affine_map\<(batch, m, n, k) -> (k, n)>,
--                      affine_map\<(batch, m, n, k) -> (batch, m, n)>]
--     ins(%A, %B: memref\<?x?x?xf32>, memref\<?x?xf32>)
--     outs(%C: memref\<?x?x?xf32>)
-- @
-- 
-- Numeric casting is performed on the operands to the inner multiplication,
-- promoting/truncating them to the same data type as the accumulator/output.
-- 
-- TODO: Allow control over the combining/accumulating op and possibly the
--       multiplication op.
--   

pattern InternalContractOpAttributes :: () => () => [Affine.Map] -> NamedAttributes
pattern $bInternalContractOpAttributes :: [Map] -> Map Name Attribute
$mInternalContractOpAttributes :: forall r. Map Name Attribute -> ([Map] -> r) -> (Void# -> r) -> r
InternalContractOpAttributes indexing_maps_ <- ((\m -> (M.lookup "indexing_maps" m)) -> (Just (PatternUtil.AffineMapArrayAttr indexing_maps_)))
  where InternalContractOpAttributes [Map]
indexing_maps_ = [(Name, Attribute)] -> Map Name Attribute
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([(Name, Attribute)] -> Map Name Attribute)
-> [(Name, Attribute)] -> Map Name Attribute
forall a b. (a -> b) -> a -> b
$ [(Name
"indexing_maps", [Map] -> Attribute
PatternUtil.AffineMapArrayAttr [Map]
indexing_maps_)]

-- | A builder for @linalg.contract@.
contract :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> [Affine.Map] -> RegionBuilderT m () -> m Value
contract :: [Type]
-> [Value] -> [Value] -> [Map] -> RegionBuilderT m () -> m Value
contract [Type]
ty0 [Value]
inputs_ [Value]
outputs_ [Map]
indexing_maps_ RegionBuilderT m ()
combiner_Builder = do
  Region
combiner_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
combiner_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.contract"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
combiner_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = ([Map] -> Map Name Attribute
InternalContractOpAttributes [Map]
indexing_maps_)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_1d_ncw_fcw
-- $conv_1d_ncw_fcw
-- Layout:
--   * Input: NCW.
--   * Kernel: FCW.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_1d_ncw_fcw@.
conv_1d_ncw_fcw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_1d_ncw_fcw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_1d_ncw_fcw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_1d_ncw_fcw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_1d_nwc_wcf
-- $conv_1d_nwc_wcf
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_1d_nwc_wcf@.
conv_1d_nwc_wcf :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_1d_nwc_wcf :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_1d_nwc_wcf [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_1d_nwc_wcf"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_1d
-- $conv_1d
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_1d@.
conv_1d :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_1d :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_1d [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_1d"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nchw_fchw
-- $conv_2d_nchw_fchw
-- Layout:
--   * Input: NCHW.
--   * Kernel: FCHW.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_2d_nchw_fchw@.
conv_2d_nchw_fchw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nchw_fchw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nchw_fchw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nchw_fchw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nchw_fchw_q
-- $conv_2d_nchw_fchw_q
-- Layout:
--   * Input: NCHW.
--   * Kernel: FCHW.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. This includes the zero
-- point offsets common to quantized operations.

-- | A builder for @linalg.conv_2d_nchw_fchw_q@.
conv_2d_nchw_fchw_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nchw_fchw_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nchw_fchw_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nchw_fchw_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_ngchw_fgchw
-- $conv_2d_ngchw_fgchw
-- Layout:
--   * Input: NGCHW.
--   * Kernel: FGCHW.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_2d_ngchw_fgchw@.
conv_2d_ngchw_fgchw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_ngchw_fgchw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_ngchw_fgchw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_ngchw_fgchw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_ngchw_gfchw
-- $conv_2d_ngchw_gfchw
-- Layout:
--   * Input: NGCHW.
--   * Kernel: GFCHW.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_2d_ngchw_gfchw@.
conv_2d_ngchw_gfchw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_ngchw_gfchw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_ngchw_gfchw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_ngchw_gfchw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_ngchw_gfchw_q
-- $conv_2d_ngchw_gfchw_q
-- Layout:
--   * Input: NGCHW.
--   * Kernel: GFCHW.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. This includes the zero
-- point offsets common to quantized operations.

-- | A builder for @linalg.conv_2d_ngchw_gfchw_q@.
conv_2d_ngchw_gfchw_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_ngchw_gfchw_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_ngchw_gfchw_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_ngchw_gfchw_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nhwc_fhwc
-- $conv_2d_nhwc_fhwc
-- Layout:
--   * Input: NHWC.
--   * Kernel: FHWC.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_2d_nhwc_fhwc@.
conv_2d_nhwc_fhwc :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_fhwc :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_fhwc [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nhwc_fhwc"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nhwc_fhwc_q
-- $conv_2d_nhwc_fhwc_q
-- Layout:
--   * Input: NHWC.
--   * Kernel: FHWC.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. This includes the zero
-- point offsets common to quantized operations.

-- | A builder for @linalg.conv_2d_nhwc_fhwc_q@.
conv_2d_nhwc_fhwc_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_fhwc_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_fhwc_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nhwc_fhwc_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nhwc_hwcf
-- $conv_2d_nhwc_hwcf
-- Layout:
--   * Input: NHWC.
--   * Kernel: HWCF.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_2d_nhwc_hwcf@.
conv_2d_nhwc_hwcf :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_hwcf :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_hwcf [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nhwc_hwcf"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nhwc_hwcf_q
-- $conv_2d_nhwc_hwcf_q
-- Layout:
--   * Input: NHWC.
--   * Kernel: HWCF.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. This includes the zero
-- point offsets common to quantized operations.

-- | A builder for @linalg.conv_2d_nhwc_hwcf_q@.
conv_2d_nhwc_hwcf_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_hwcf_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwc_hwcf_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nhwc_hwcf_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nhwgc_gfhwc
-- $conv_2d_nhwgc_gfhwc
-- Layout:
--   * Input: NHWGC.
--   * Kernel: GFHWC.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_2d_nhwgc_gfhwc@.
conv_2d_nhwgc_gfhwc :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwgc_gfhwc :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwgc_gfhwc [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nhwgc_gfhwc"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d_nhwgc_gfhwc_q
-- $conv_2d_nhwgc_gfhwc_q
-- Layout:
--   * Input: NHWGC.
--   * Kernel: GFHWC.
-- 
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. This includes the zero
-- point offsets common to quantized operations.

-- | A builder for @linalg.conv_2d_nhwgc_gfhwc_q@.
conv_2d_nhwgc_gfhwc_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwgc_gfhwc_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d_nhwgc_gfhwc_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d_nhwgc_gfhwc_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_2d
-- $conv_2d
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_2d@.
conv_2d :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_2d [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_2d"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_3d_ncdhw_fcdhw
-- $conv_3d_ncdhw_fcdhw
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_3d_ncdhw_fcdhw@.
conv_3d_ncdhw_fcdhw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d_ncdhw_fcdhw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d_ncdhw_fcdhw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_3d_ncdhw_fcdhw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_3d_ndhwc_dhwcf
-- $conv_3d_ndhwc_dhwcf
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_3d_ndhwc_dhwcf@.
conv_3d_ndhwc_dhwcf :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d_ndhwc_dhwcf :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d_ndhwc_dhwcf [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_3d_ndhwc_dhwcf"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_3d_ndhwc_dhwcf_q
-- $conv_3d_ndhwc_dhwcf_q
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. This includes the zero
-- point offsets common to quantized operations.

-- | A builder for @linalg.conv_3d_ndhwc_dhwcf_q@.
conv_3d_ndhwc_dhwcf_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d_ndhwc_dhwcf_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d_ndhwc_dhwcf_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_3d_ndhwc_dhwcf_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * conv_3d
-- $conv_3d
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.conv_3d@.
conv_3d :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
conv_3d [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.conv_3d"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * copy
-- $copy
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.copy@.
copy :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
copy :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
copy [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.copy"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_1d_ncw_cw
-- $depthwise_conv_1d_ncw_cw
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. Multiplier is set to 1
-- which is a special case for most depthwise convolutions.

-- | A builder for @linalg.depthwise_conv_1d_ncw_cw@.
depthwise_conv_1d_ncw_cw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_1d_ncw_cw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_1d_ncw_cw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_1d_ncw_cw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_1d_nwc_wc
-- $depthwise_conv_1d_nwc_wc
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. Multiplier is set to 1
-- which is a special case for most depthwise convolutions.

-- | A builder for @linalg.depthwise_conv_1d_nwc_wc@.
depthwise_conv_1d_nwc_wc :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_1d_nwc_wc :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_1d_nwc_wc [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_1d_nwc_wc"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_1d_nwc_wcm
-- $depthwise_conv_1d_nwc_wcm
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.depthwise_conv_1d_nwc_wcm@.
depthwise_conv_1d_nwc_wcm :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_1d_nwc_wcm :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_1d_nwc_wcm [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_1d_nwc_wcm"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_2d_nchw_chw
-- $depthwise_conv_2d_nchw_chw
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. Multiplier is set to 1
-- which is a special case for most depthwise convolutions.

-- | A builder for @linalg.depthwise_conv_2d_nchw_chw@.
depthwise_conv_2d_nchw_chw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nchw_chw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nchw_chw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_2d_nchw_chw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_2d_nhwc_hwc
-- $depthwise_conv_2d_nhwc_hwc
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. Multiplier is set to 1
-- which is a special case for most depthwise convolutions.

-- | A builder for @linalg.depthwise_conv_2d_nhwc_hwc@.
depthwise_conv_2d_nhwc_hwc :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwc :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwc [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_2d_nhwc_hwc"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_2d_nhwc_hwc_q
-- $depthwise_conv_2d_nhwc_hwc_q
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.depthwise_conv_2d_nhwc_hwc_q@.
depthwise_conv_2d_nhwc_hwc_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwc_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwc_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_2d_nhwc_hwc_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_2d_nhwc_hwcm
-- $depthwise_conv_2d_nhwc_hwcm
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.depthwise_conv_2d_nhwc_hwcm@.
depthwise_conv_2d_nhwc_hwcm :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwcm :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwcm [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_2d_nhwc_hwcm"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_2d_nhwc_hwcm_q
-- $depthwise_conv_2d_nhwc_hwcm_q
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.depthwise_conv_2d_nhwc_hwcm_q@.
depthwise_conv_2d_nhwc_hwcm_q :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwcm_q :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_2d_nhwc_hwcm_q [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_2d_nhwc_hwcm_q"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_3d_ncdhw_cdhw
-- $depthwise_conv_3d_ncdhw_cdhw
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. Multiplier is set to 1
-- which is a special case for most depthwise convolutions.

-- | A builder for @linalg.depthwise_conv_3d_ncdhw_cdhw@.
depthwise_conv_3d_ncdhw_cdhw :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_3d_ncdhw_cdhw :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_3d_ncdhw_cdhw [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_3d_ncdhw_cdhw"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_3d_ndhwc_dhwc
-- $depthwise_conv_3d_ndhwc_dhwc
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. Multiplier is set to 1
-- which is a special case for most depthwise convolutions.

-- | A builder for @linalg.depthwise_conv_3d_ndhwc_dhwc@.
depthwise_conv_3d_ndhwc_dhwc :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_3d_ndhwc_dhwc :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_3d_ndhwc_dhwc [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_3d_ndhwc_dhwc"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * depthwise_conv_3d_ndhwc_dhwcm
-- $depthwise_conv_3d_ndhwc_dhwcm
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.depthwise_conv_3d_ndhwc_dhwcm@.
depthwise_conv_3d_ndhwc_dhwcm :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_3d_ndhwc_dhwcm :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
depthwise_conv_3d_ndhwc_dhwcm [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.depthwise_conv_3d_ndhwc_dhwcm"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * div
-- $div
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.div@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.div@.
div :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
div :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
div [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.div"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * div_unsigned
-- $div_unsigned
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.div@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.div_unsigned@.
div_unsigned :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
div_unsigned :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
div_unsigned [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.div_unsigned"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * dot
-- $dot
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.dot@.
dot :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
dot :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
dot [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.dot"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * elemwise_binary
-- $elemwise_binary
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.elemwise_binary@.
elemwise_binary :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
elemwise_binary :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
elemwise_binary [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.elemwise_binary"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * elemwise_unary
-- $elemwise_unary
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.elemwise_unary@.
elemwise_unary :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
elemwise_unary :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
elemwise_unary [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.elemwise_unary"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * erf
-- $erf
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.erf@.
erf :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
erf :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
erf [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.erf"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * exp
-- $exp
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.exp@.
exp :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
exp :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
exp [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.exp"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * fill
-- $fill
-- Works for arbitrary ranked output tensors since the operation performs scalar
-- accesses only and is thus rank polymorphic. Numeric casting is performed on
-- the value operand, promoting it to the same data type as the output.

-- | A builder for @linalg.fill@.
fill :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
fill :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
fill [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.fill"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * fill_rng_2d
-- $fill_rng_2d
-- The operation generations pseudo random numbers using a linear congruential
-- generator. It provides no guarantees regarding the distribution of the
-- generated random numbers. Instead of generating the random numbers
-- sequentially, it instantiates one random number generator per data element
-- and runs them in parallel. The seed operand and the indices of the data
-- element seed the random number generation. The min and max operands limit
-- the range of the generated random numbers.

-- | A builder for @linalg.fill_rng_2d@.
fill_rng_2d :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
fill_rng_2d :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
fill_rng_2d [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.fill_rng_2d"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * floor
-- $floor
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.floor@.
floor :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
floor :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
floor [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.floor"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * generic
-- $generic
-- 
-- Generic Linalg op form where the key properties of the computation are
-- specified as attributes. In pretty form, a @linalg.generic@ op is written
-- as:
-- 
--   @
--   linalg.generic \#trait_attribute
--       ins(%A, %B : memref\<?x?xf32, stride_specification>,
--                    memref\<?x?xf32, stride_specification>)
--       outs(%C : memref\<?x?xf32, stride_specification>)
--       attrs = {other-optional-attributes}
--       {region}
--   @
-- 
-- Where \#trait_attributes is an alias of a dictionary attribute containing:
--   - doc [optional]: a documentation string
--   - indexing_maps: a list of AffineMapAttr, one AffineMapAttr per each input
--     and output view. Such AffineMapAttr specifies the mapping between the
--     loops and the indexing within each view.
--   - library_call [optional]: a StringAttr containing the name of an
--     external library function that the linalg.generic operation maps to.
--     The external library is assumed to be dynamically linked and no strong
--     compile-time guarantees are provided. In the absence of such a library
--     call, linalg.generic will always lower to loops.
--   - iterator_types: an ArrayAttr specifying the type of the enclosing loops.
--     Each element of the list represents and iterator of one of the following
--     types:
--       parallel, reduction, window
-- 
-- Example:
-- Defining a \#matmul_trait attribute in MLIR can be done as follows:
--   @
--   \#matmul_accesses = [
--     (m, n, k) -> (m, k),
--     (m, n, k) -> (k, n),
--     (m, n, k) -> (m, n)
--   ]
--   \#matmul_trait = {
--     doc = \"C(m, n) += A(m, k) * B(k, n)\",
--     indexing_maps = \#matmul_accesses,
--     library_call = \"linalg_matmul\",
--     iterator_types = [\"parallel\", \"parallel\", \"reduction\"]
--   }
--   @
-- 
-- And can be reused in multiple places as:
--   @
--   linalg.generic \#matmul_trait
--     ins(%A, %B : memref\<?x?xf32, stride_specification>,
--                  memref\<?x?xf32, stride_specification>)
--     outs(%C : memref\<?x?xf32, stride_specification>)
--     {other-optional-attributes} {
--     ^bb0(%a: f32, %b: f32, %c: f32) :
--       %d = arith.mulf %a, %b: f32
--       %e = arith.addf %c, %d: f32
--       linalg.yield %e : f32
--   }
--   @
-- 
-- This may lower to either:
--   @
--   call \@linalg_matmul(%A, %B, %C) :
--     (memref\<?x?xf32, stride_specification>,
--      memref\<?x?xf32, stride_specification>,
--      memref\<?x?xf32, stride_specification>)
--     -> ()
--   @
-- 
-- or IR resembling:
-- @
-- scf.for %m = %c0 to %M step %c1 {
--   scf.for %n = %c0 to %N step %c1 {
--     scf.for %k = %c0 to %K step %c1 {
--       %a = load %A[%m, %k] : memref\<?x?xf32, stride_specification>
--       %b = load %B[%k, %n] : memref\<?x?xf32, stride_specification>
--       %c = load %C[%m, %n] : memref\<?x?xf32, stride_specification>
--       %d = arith.mulf %a, %b: f32
--       %e = arith.addf %c, %d: f32
--       store %e, %C[%m, %n] : memref\<?x?x?xf32, stride_specification>
--     }
--   }
-- }
-- @
-- 
-- To allow progressive lowering from the value world (a.k.a tensor values) to
-- the buffer world (a.k.a memref values), a @linalg.generic@ op allows mixing
-- tensors and buffers operands and tensor results.
-- 
-- @
-- %C = linalg.generic \#trait_attribute
--   ins(%A, %B : tensor\<?x?xf32>, memref\<?x?xf32, stride_specification>)
--   outs(%C : tensor\<?x?xf32>)
--   {other-optional-attributes}
--   {region}
--   -> (tensor\<?x?xf32>)
-- @
--   

-- * log
-- $log
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.log@.
log :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
log :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
log [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.log"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * map
-- $map
-- 
-- Models elementwise operations on tensors in terms of arithmetic operations
-- on the corresponding elements.
-- 
-- Example:
-- @
--   %add = linalg.map
--       ins(%lhs, %rhs : tensor\<64xf32>, tensor\<64xf32>)
--       outs(%init: tensor\<64xf32>)
--       (%lhs_elem: f32, %rhs_elem: f32) {
--         %0 = arith.addf %lhs_elem, %rhs_elem: f32
--         linalg.yield %0: f32
--       }
-- @
-- 
-- Shortened print form is available. Applies to simple maps with one
-- non-yield operation inside the body.
-- 
-- The example above will be printed as:
-- @
--   %add = linalg.map { arith.addf }
--       ins(%lhs, %rhs : tensor\<64xf32>, tensor\<64xf32>)
--       outs(%init: tensor\<64xf32>)
-- @
--   

-- | A builder for @linalg.map@.
map :: () => MonadBlockBuilder m => [Type] -> [Value] -> Value -> RegionBuilderT m () -> m Value
map :: [Type] -> [Value] -> Value -> RegionBuilderT m () -> m Value
map [Type]
ty0 [Value]
inputs_ Value
init_  RegionBuilderT m ()
mapper_Builder = do
  Region
mapper_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
mapper_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.map"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ [(Value -> Name
AST.operand Value
init_)])
          , opRegions :: [Region]
opRegions = [Region
mapper_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
          }))

-- * matmul
-- $matmul
-- 
-- Numeric casting is performed on the operands to the inner multiply,
-- promoting them to the same data type as the accumulator/output.
-- 
-- Broadcast and Transpose semantics can be appiled by specifying the explicit attribute
-- \'indexing_maps\' as shown below.This is a list attribute, so the list must include all
-- the maps if specified.
-- 
-- Example Transpose:
-- @
-- linalg.matmul indexing_maps = [
--                affine_map\<(d0, d1, d2) -> (d2, d0)>, // transpose
--                affine_map\<(d0, d1, d2) -> (d2, d1)>,
--                affine_map\<(d0, d1, d2) -> (d0, d1)>
--                ]
--                ins(%arg0, %arg1 : memref\<5x3xf32>,memref\<5x7xf32>)
--                outs(%arg2: memref\<3x7xf32>)
--  @
-- 
-- Example Broadcast:
--  @
-- linalg.matmul indexing_maps = [
--                affine_map\<(d0, d1, d2) -> (d2)>,     // broadcast
--                affine_map\<(d0, d1, d2) -> (d2, d1)>,
--                affine_map\<(d0, d1, d2) -> (d0, d1)>
--               ]
--               ins(%arg0, %arg1 : memref\<3xf32>, memref\<5x7xf32>)
--               outs(%arg2: memref\<3x7xf32>)
-- @
-- 
-- Example Broadcast and transpose:
-- @
-- linalg.matmul indexing_maps = [
--                   affine_map\<(d0, d1, d2) -> (d2, d0)>, // transpose
--                   affine_map\<(d0, d1, d2) -> (d2)>,     // broadcast
--                   affine_map\<(d0, d1, d2) -> (d0, d1)>
--                 ]
--                 ins(%arg0, %arg1 : memref\<5x3xf32>, memref\<7xf32>) outs(%arg2: memref\<3x7xf32>)
-- @
-- 

pattern OptionalAffineMapArrayAttr :: Maybe [Affine.Map] -> Maybe Attribute
pattern $bOptionalAffineMapArrayAttr :: Maybe [Map] -> Maybe Attribute
$mOptionalAffineMapArrayAttr :: forall r.
Maybe Attribute -> (Maybe [Map] -> r) -> (Void# -> r) -> r
OptionalAffineMapArrayAttr x <- ((\case Just (PatternUtil.AffineMapArrayAttr y) -> Just y; Nothing -> Nothing) -> x)
  where OptionalAffineMapArrayAttr Maybe [Map]
x = case Maybe [Map]
x of Just [Map]
y -> Attribute -> Maybe Attribute
forall a. a -> Maybe a
Just ([Map] -> Attribute
PatternUtil.AffineMapArrayAttr [Map]
y); Maybe [Map]
Nothing -> Maybe Attribute
forall a. Maybe a
Nothing

pattern InternalMatmulOpAttributes :: () => () => Maybe [Affine.Map] -> NamedAttributes
pattern $bInternalMatmulOpAttributes :: Maybe [Map] -> Map Name Attribute
$mInternalMatmulOpAttributes :: forall r.
Map Name Attribute -> (Maybe [Map] -> r) -> (Void# -> r) -> r
InternalMatmulOpAttributes indexing_maps_ <- ((\m -> (M.lookup "indexing_maps" m)) -> (OptionalAffineMapArrayAttr indexing_maps_))
  where InternalMatmulOpAttributes Maybe [Map]
indexing_maps_ = [(Name, Attribute)] -> Map Name Attribute
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([(Name, Attribute)] -> Map Name Attribute)
-> [(Name, Attribute)] -> Map Name Attribute
forall a b. (a -> b) -> a -> b
$ (Maybe (Name, Attribute) -> [(Name, Attribute)]
forall a. Maybe a -> [a]
Data.Maybe.maybeToList (Maybe (Name, Attribute) -> [(Name, Attribute)])
-> Maybe (Name, Attribute) -> [(Name, Attribute)]
forall a b. (a -> b) -> a -> b
$ (Name
"indexing_maps",) (Attribute -> (Name, Attribute))
-> Maybe Attribute -> Maybe (Name, Attribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Maybe [Map] -> Maybe Attribute
OptionalAffineMapArrayAttr Maybe [Map]
indexing_maps_)

-- | A builder for @linalg.matmul@.
matmul :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> Maybe [Affine.Map] -> RegionBuilderT m () -> m Value
matmul :: [Type]
-> [Value]
-> [Value]
-> Maybe [Map]
-> RegionBuilderT m ()
-> m Value
matmul [Type]
ty0 [Value]
inputs_ [Value]
outputs_ Maybe [Map]
indexing_maps_ RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.matmul"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Maybe [Map] -> Map Name Attribute
InternalMatmulOpAttributes Maybe [Map]
indexing_maps_)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * matmul_transpose_a
-- $matmul_transpose_a
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.matmul_transpose_a@.
matmul_transpose_a :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
matmul_transpose_a :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
matmul_transpose_a [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.matmul_transpose_a"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * matmul_transpose_b
-- $matmul_transpose_b
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.matmul_transpose_b@.
matmul_transpose_b :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
matmul_transpose_b :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
matmul_transpose_b [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.matmul_transpose_b"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * matvec
-- $matvec
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.matvec@.
matvec :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
matvec :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
matvec [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.matvec"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * max
-- $max
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.max@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.max@.
max :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
max :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
max [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.max"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * min
-- $min
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.min@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.min@.
min :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
min :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
min [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.min"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * mmt4d
-- $mmt4d
-- Differences from linalg.matmul:
-- * The right hand side is transposed, whence the \'t\' in \'mmt\'.
-- * The input and output tensors have a 4D shape instead of a 2D shape. They
--   are interpreted as 2D matrices with one level of 2D tile subdivision,
--   whence the 2+2=4 dimensions. The inner tile dimensions are identified with
--   \'0\' suffixes below, for instance the LHS matrix shape (M, K, M0, K0) reads
--   as: MxK tiles, each of shape M0xK0.

-- | A builder for @linalg.mmt4d@.
mmt4d :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
mmt4d :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
mmt4d [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.mmt4d"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * mul
-- $mul
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.mul@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.mul@.
mul :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
mul :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
mul [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.mul"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * negf
-- $negf
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.negf@.
negf :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
negf :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
negf [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.negf"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nchw_max
-- $pooling_nchw_max
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nchw_max@.
pooling_nchw_max :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nchw_max :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nchw_max [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nchw_max"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nchw_sum
-- $pooling_nchw_sum
-- Layout:
--   * Input: NCHW.
--   * Kernel: HW.
-- 
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nchw_sum@.
pooling_nchw_sum :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nchw_sum :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nchw_sum [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nchw_sum"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_ncw_max
-- $pooling_ncw_max
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_ncw_max@.
pooling_ncw_max :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ncw_max :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ncw_max [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_ncw_max"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_ncw_sum
-- $pooling_ncw_sum
-- Layout:
--   * Input: NCW.
--   * Kernel: W.
-- 
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_ncw_sum@.
pooling_ncw_sum :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ncw_sum :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ncw_sum [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_ncw_sum"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_ndhwc_max
-- $pooling_ndhwc_max
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_ndhwc_max@.
pooling_ndhwc_max :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ndhwc_max :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ndhwc_max [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_ndhwc_max"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_ndhwc_min
-- $pooling_ndhwc_min
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_ndhwc_min@.
pooling_ndhwc_min :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ndhwc_min :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ndhwc_min [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_ndhwc_min"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_ndhwc_sum
-- $pooling_ndhwc_sum
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_ndhwc_sum@.
pooling_ndhwc_sum :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ndhwc_sum :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_ndhwc_sum [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_ndhwc_sum"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nhwc_max
-- $pooling_nhwc_max
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nhwc_max@.
pooling_nhwc_max :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_max :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_max [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nhwc_max"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nhwc_max_unsigned
-- $pooling_nhwc_max_unsigned
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nhwc_max_unsigned@.
pooling_nhwc_max_unsigned :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_max_unsigned :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_max_unsigned [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nhwc_max_unsigned"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nhwc_min
-- $pooling_nhwc_min
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nhwc_min@.
pooling_nhwc_min :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_min :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_min [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nhwc_min"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nhwc_min_unsigned
-- $pooling_nhwc_min_unsigned
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nhwc_min_unsigned@.
pooling_nhwc_min_unsigned :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_min_unsigned :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_min_unsigned [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nhwc_min_unsigned"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nhwc_sum
-- $pooling_nhwc_sum
-- Layout:
--   * Input: NHWC.
--   * Kernel: HW.
-- 
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nhwc_sum@.
pooling_nhwc_sum :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_sum :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nhwc_sum [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nhwc_sum"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nwc_max
-- $pooling_nwc_max
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nwc_max@.
pooling_nwc_max :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_max :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_max [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nwc_max"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nwc_max_unsigned
-- $pooling_nwc_max_unsigned
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nwc_max_unsigned@.
pooling_nwc_max_unsigned :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_max_unsigned :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_max_unsigned [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nwc_max_unsigned"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nwc_min
-- $pooling_nwc_min
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nwc_min@.
pooling_nwc_min :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_min :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_min [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nwc_min"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nwc_min_unsigned
-- $pooling_nwc_min_unsigned
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nwc_min_unsigned@.
pooling_nwc_min_unsigned :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_min_unsigned :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_min_unsigned [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nwc_min_unsigned"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * pooling_nwc_sum
-- $pooling_nwc_sum
-- Layout:
--   * Input: NWC.
--   * Kernel: W.
-- 
-- Numeric casting is performed on the input operand, promoting it to the same
-- data type as the accumulator/output.

-- | A builder for @linalg.pooling_nwc_sum@.
pooling_nwc_sum :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_sum :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
pooling_nwc_sum [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.pooling_nwc_sum"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * powf
-- $powf
-- Only applies to floating point values.
-- 
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.powf@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.powf@.
powf :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
powf :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
powf [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.powf"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * quantized_batch_matmul
-- $quantized_batch_matmul
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. The quantized variant
-- includes zero-point adjustments for the left and right operands of the
-- matmul.

-- | A builder for @linalg.quantized_batch_matmul@.
quantized_batch_matmul :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
quantized_batch_matmul :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
quantized_batch_matmul [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.quantized_batch_matmul"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * quantized_matmul
-- $quantized_matmul
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output. The quantized variant
-- includes zero-point adjustments for the left and right operands of the
-- matmul.

-- | A builder for @linalg.quantized_matmul@.
quantized_matmul :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
quantized_matmul :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
quantized_matmul [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.quantized_matmul"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * reciprocal
-- $reciprocal
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.reciprocal@.
reciprocal :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
reciprocal :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
reciprocal [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.reciprocal"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * reduce
-- $reduce
-- 
-- Executes @combiner@ on the @dimensions@ of @inputs@ and returns the
-- reduced result. The @dimensions@ attribute needs to list the reduction
-- dimensions in increasing order.
-- 
-- Example:
-- @
--   %reduce = linalg.reduce
--       ins(%input:tensor\<16x32x64xf32>)
--       outs(%init:tensor\<16x64xf32>)
--       dimensions = [1]
--       (%in: f32, %out: f32) {
--         %0 = arith.addf %out, %in: f32
--         linalg.yield %0: f32
--       }
-- @
-- 
-- Shortened print form is available. Applies to simple (not variadic) reduces
-- with one non-yield operation inside the body. Applies only if the operation
-- takes @%out@ as the first argument.
-- 
-- The example above will be printed as:
-- @
--       %reduce = linalg.reduce { arith.addf }
--       ins(%input:tensor\<16x32x64xf32>)
--       outs(%init:tensor\<16x64xf32>)
--       dimensions = [1]
-- @
--   

-- * round
-- $round
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.round@.
round :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
round :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
round [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.round"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * rsqrt
-- $rsqrt
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.rsqrt@.
rsqrt :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
rsqrt :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
rsqrt [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.rsqrt"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * select
-- $select
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.select@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.select@.
select :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
select :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
select [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.select"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * sqrt
-- $sqrt
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.sqrt@.
sqrt :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
sqrt :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
sqrt [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.sqrt"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * square
-- $square
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.square@.
square :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
square :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
square [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.square"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * sub
-- $sub
-- The shapes and element types must be identical. The appropriate casts,
-- broadcasts and reductions should be done previously to calling this op.
-- 
-- This means reduction/broadcast/element cast semantics is explicit. Further
-- passes can take that into account when lowering this code. For example,
-- a @linalg.broadcast@ + @linalg.sub@ sequence can be lowered to a
-- @linalg.generic@ with different affine maps for the two operands.

-- | A builder for @linalg.sub@.
sub :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
sub :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
sub [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.sub"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * tanh
-- $tanh
-- No numeric casting is performed on the input operand.

-- | A builder for @linalg.tanh@.
tanh :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
tanh :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
tanh [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.tanh"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))

-- * transpose
-- $transpose
-- 
-- Permutes the dimensions of @input@ according to the given @permutation@.
--   @dim(result, i) = dim(input, permutation[i])@
-- 
-- This op actually moves data, unlike @memref.transpose@ which is a metadata
-- operation only that produces a transposed \"view\".
-- 
-- Example:
-- @
--   %transpose = linalg.transpose
--       ins(%input:tensor\<16x64xf32>)
--       outs(%init:tensor\<64x16xf32>)
--       permutation = [1, 0]
-- @
--   

-- * vecmat
-- $vecmat
-- Numeric casting is performed on the operands to the inner multiply, promoting
-- them to the same data type as the accumulator/output.

-- | A builder for @linalg.vecmat@.
vecmat :: () => MonadBlockBuilder m => [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
vecmat :: [Type] -> [Value] -> [Value] -> RegionBuilderT m () -> m Value
vecmat [Type]
ty0 [Value]
inputs_ [Value]
outputs_  RegionBuilderT m ()
region_Builder = do
  Region
region_ <- RegionBuilderT m () -> m Region
forall (m :: * -> *). Monad m => RegionBuilderT m () -> m Region
AST.buildRegion RegionBuilderT m ()
region_Builder
  ([Value] -> Value) -> m [Value] -> m Value
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
Control.Monad.liftM [Value] -> Value
forall a. [a] -> a
Prelude.head (Operation -> m [Value]
forall (m :: * -> *). MonadBlockBuilder m => Operation -> m [Value]
AST.emitOp (Operation :: forall operand.
Name
-> Location
-> ResultTypes
-> [operand]
-> [Region]
-> [Name]
-> Map Name Attribute
-> AbstractOperation operand
Operation
          { opName :: Name
opName = Name
"linalg.vecmat"
          , opLocation :: Location
opLocation = Location
UnknownLocation
          , opResultTypes :: ResultTypes
opResultTypes = [Type] -> ResultTypes
Explicit ([Type]
ty0)
          , opOperands :: [Name]
opOperands = (([Value] -> [Name]
AST.operands [Value]
inputs_) [Name] -> [Name] -> [Name]
forall a. [a] -> [a] -> [a]
++ ([Value] -> [Name]
AST.operands [Value]
outputs_))
          , opRegions :: [Region]
opRegions = [Region
region_]
          , opSuccessors :: [Name]
opSuccessors = []
          , opAttributes :: Map Name Attribute
opAttributes = (Map Name Attribute
NoAttrs)
              Map Name Attribute -> Map Name Attribute -> Map Name Attribute
forall a. Semigroup a => a -> a -> a
<> Name -> Attribute -> Map Name Attribute
AST.namedAttribute Name
"operand_segment_sizes"
                   (Type -> DenseElements -> Attribute
DenseElementsAttr ([Int] -> Type -> Type
VectorType [Int
2] (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Signedness -> UInt -> Type
IntegerType Signedness
Unsigned UInt
32) (DenseElements -> Attribute) -> DenseElements -> Attribute
forall a b. (a -> b) -> a -> b
$
                      IStorableArray Int Word32 -> DenseElements
forall i.
(Show i, Ix i) =>
IStorableArray i Word32 -> DenseElements
DenseUInt32 (IStorableArray Int Word32 -> DenseElements)
-> IStorableArray Int Word32 -> DenseElements
forall a b. (a -> b) -> a -> b
$ (Int, Int) -> [Word32] -> IStorableArray Int Word32
forall (a :: * -> * -> *) e i.
(IArray a e, Ix i) =>
(i, i) -> [e] -> a i e
IArray.listArray (Int
1 :: Int, Int
2) ([Word32] -> IStorableArray Int Word32)
-> [Word32] -> IStorableArray Int Word32
forall a b. (a -> b) -> a -> b
$ Int -> Word32
forall a b. (Integral a, Num b) => a -> b
Prelude.fromIntegral (Int -> Word32) -> [Int] -> [Word32]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [[Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
inputs_), [Name] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
Prelude.length ([Value] -> [Name]
AST.operands [Value]
outputs_)])

          }))