Compute several tensors via an extern function. Parameters ---------- shape: tuple or list of tuples. The shape of the outputs. inputs: list of Tensor The inputs fcompute: lambda function of inputs, outputs-> stmt Specifies the IR statement to do the co
(
shape,
inputs,
fcompute,
name="extern",
dtype=None,
in_buffers=None,
out_buffers=None,
tag="",
attrs=None,
)
| 207 | |
| 208 | |
| 209 | def extern( |
| 210 | shape, |
| 211 | inputs, |
| 212 | fcompute, |
| 213 | name="extern", |
| 214 | dtype=None, |
| 215 | in_buffers=None, |
| 216 | out_buffers=None, |
| 217 | tag="", |
| 218 | attrs=None, |
| 219 | ): |
| 220 | """Compute several tensors via an extern function. |
| 221 | |
| 222 | Parameters |
| 223 | ---------- |
| 224 | shape: tuple or list of tuples. |
| 225 | The shape of the outputs. |
| 226 | |
| 227 | inputs: list of Tensor |
| 228 | The inputs |
| 229 | |
| 230 | fcompute: lambda function of inputs, outputs-> stmt |
| 231 | Specifies the IR statement to do the computation. |
| 232 | See the following note for function signature of fcompute |
| 233 | |
| 234 | .. note:: |
| 235 | **Parameters** |
| 236 | |
| 237 | - **ins** (list of :any:`tvm.tirx.Buffer`) - Placeholder for each inputs |
| 238 | - **outs** (list of :any:`tvm.tirx.Buffer`) - Placeholder for each outputs |
| 239 | |
| 240 | **Returns** |
| 241 | |
| 242 | - **stmt** (:any:`tvm.tirx.Stmt`) - The statement that carries out array computation. |
| 243 | |
| 244 | name: str, optional |
| 245 | The name hint of the tensor |
| 246 | |
| 247 | dtype: str or list of str, optional |
| 248 | The data types of outputs, |
| 249 | by default dtype will be same as inputs. |
| 250 | |
| 251 | in_buffers: tvm.tirx.Buffer or list of tvm.tirx.Buffer, optional |
| 252 | Input buffers. |
| 253 | |
| 254 | out_buffers: tvm.tirx.Buffer or list of tvm.tirx.Buffer, optional |
| 255 | Output buffers. |
| 256 | |
| 257 | |
| 258 | tag: str, optional |
| 259 | Additonal tag information about the compute. |
| 260 | |
| 261 | attrs: dict, optional |
| 262 | The additional auxiliary attributes about the compute. |
| 263 | |
| 264 | Returns |
| 265 | ------- |
| 266 | tensor: Tensor or list of Tensors |