vinx13 commented on a change in pull request #9432: URL: https://github.com/apache/tvm/pull/9432#discussion_r743149621
########## File path: python/tvm/script/tir/__init__.pyi ########## @@ -0,0 +1,267 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# pylint: disable=redefined-builtin +from typing import ( + Any, + Callable, + ContextManager, + Dict, + Iterable, + Optional, + Tuple, + Union, + Sequence, + List, + Mapping, + overload, +) +from numbers import Number +import builtins + +from tvm.tir.function import PrimFunc +from tvm.tir import PrimExpr, Range, IterVar, Var +from tvm.runtime import Object +from .node import BufferSlice + +""" +redefine types +""" + +class Buffer(Var): + def __getitem__( + self: Buffer, pos: Tuple[Union[int, PrimExpr], Union[int, PrimExpr]] + ) -> Buffer: ... + @property + def data(self: Buffer) -> Ptr: ... + +""" +Variables and constants +""" + +def bool(imm: Union[PrimExpr, builtins.bool, Number]) -> PrimExpr: ... +def int8(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def int16(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def int32(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def int64(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def uint8(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def uint16(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def uint32(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def uint64(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def float8(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def float16(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def float32(imm: Union[PrimExpr, Number]) -> PrimExpr: ... +def float64(imm: Union[PrimExpr, Number]) -> PrimExpr: ... + +""" +Intrinsic +""" + +def min_value(dtype): ... Review comment: can we type these functions? If there are some args that can't be typed, please explicitly add `Any` as its type -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
