# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class IDSTQuan(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = IDSTQuan()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsIDSTQuan(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # IDSTQuan
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # IDSTQuan
    def Buffer(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Int8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1))
        return 0

    # IDSTQuan
    def BufferAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int8Flags, o)
        return 0

    # IDSTQuan
    def BufferLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # IDSTQuan
    def BufferIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # IDSTQuan
    def Alpha(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # IDSTQuan
    def AlphaAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

    # IDSTQuan
    def AlphaLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # IDSTQuan
    def AlphaIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

    # IDSTQuan
    def Type(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # IDSTQuan
    def UseInt32(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

    # IDSTQuan
    def QuantScale(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # IDSTQuan
    def ScaleIn(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # IDSTQuan
    def ScaleOut(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # IDSTQuan
    def AMax(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # IDSTQuan
    def AMin(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # IDSTQuan
    def ReadType(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # IDSTQuan
    def HasScaleInt(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

def IDSTQuanStart(builder): builder.StartObject(11)
def Start(builder):
    return IDSTQuanStart(builder)
def IDSTQuanAddBuffer(builder, buffer): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(buffer), 0)
def AddBuffer(builder, buffer):
    return IDSTQuanAddBuffer(builder, buffer)
def IDSTQuanStartBufferVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def StartBufferVector(builder, numElems):
    return IDSTQuanStartBufferVector(builder, numElems)
def IDSTQuanAddAlpha(builder, alpha): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(alpha), 0)
def AddAlpha(builder, alpha):
    return IDSTQuanAddAlpha(builder, alpha)
def IDSTQuanStartAlphaVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartAlphaVector(builder, numElems):
    return IDSTQuanStartAlphaVector(builder, numElems)
def IDSTQuanAddType(builder, type): builder.PrependInt32Slot(2, type, 0)
def AddType(builder, type):
    return IDSTQuanAddType(builder, type)
def IDSTQuanAddUseInt32(builder, useInt32): builder.PrependBoolSlot(3, useInt32, 0)
def AddUseInt32(builder, useInt32):
    return IDSTQuanAddUseInt32(builder, useInt32)
def IDSTQuanAddQuantScale(builder, quantScale): builder.PrependFloat32Slot(4, quantScale, 0.0)
def AddQuantScale(builder, quantScale):
    return IDSTQuanAddQuantScale(builder, quantScale)
def IDSTQuanAddScaleIn(builder, scaleIn): builder.PrependFloat32Slot(5, scaleIn, 0.0)
def AddScaleIn(builder, scaleIn):
    return IDSTQuanAddScaleIn(builder, scaleIn)
def IDSTQuanAddScaleOut(builder, scaleOut): builder.PrependFloat32Slot(6, scaleOut, 0.0)
def AddScaleOut(builder, scaleOut):
    return IDSTQuanAddScaleOut(builder, scaleOut)
def IDSTQuanAddAMax(builder, aMax): builder.PrependInt32Slot(7, aMax, 0)
def AddAMax(builder, aMax):
    return IDSTQuanAddAMax(builder, aMax)
def IDSTQuanAddAMin(builder, aMin): builder.PrependInt32Slot(8, aMin, 0)
def AddAMin(builder, aMin):
    return IDSTQuanAddAMin(builder, aMin)
def IDSTQuanAddReadType(builder, readType): builder.PrependInt32Slot(9, readType, 0)
def AddReadType(builder, readType):
    return IDSTQuanAddReadType(builder, readType)
def IDSTQuanAddHasScaleInt(builder, hasScaleInt): builder.PrependBoolSlot(10, hasScaleInt, 0)
def AddHasScaleInt(builder, hasScaleInt):
    return IDSTQuanAddHasScaleInt(builder, hasScaleInt)
def IDSTQuanEnd(builder): return builder.EndObject()
def End(builder):
    return IDSTQuanEnd(builder)