stablehlo

package
v2.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PresetQuantizationMethod_PresetMethod_name = map[int32]string{
		0: "METHOD_UNSPECIFIED",
		1: "WEIGHT_ONLY",
		2: "POST_TRAINING_QUANTIZATION_DYNAMIC_RANGE",
		3: "FLOAT16",
		4: "POST_TRAINING_QUANTIZATION_STATIC_RANGE",
	}
	PresetQuantizationMethod_PresetMethod_value = map[string]int32{
		"METHOD_UNSPECIFIED": 0,
		"WEIGHT_ONLY":        1,
		"POST_TRAINING_QUANTIZATION_DYNAMIC_RANGE": 2,
		"FLOAT16": 3,
		"POST_TRAINING_QUANTIZATION_STATIC_RANGE": 4,
	}
)

Enum value maps for PresetQuantizationMethod_PresetMethod.

View Source
var (
	QuantizationComponentSpec_QuantizationComponent_name = map[int32]string{
		0: "COMPONENT_UNSPECIFIED",
		1: "COMPONENT_ACTIVATION",
		2: "COMPONENT_WEIGHT",
		3: "COMPONENT_BIAS",
	}
	QuantizationComponentSpec_QuantizationComponent_value = map[string]int32{
		"COMPONENT_UNSPECIFIED": 0,
		"COMPONENT_ACTIVATION":  1,
		"COMPONENT_WEIGHT":      2,
		"COMPONENT_BIAS":        3,
	}
)

Enum value maps for QuantizationComponentSpec_QuantizationComponent.

View Source
var (
	QuantizationComponentSpec_BitWidth_name = map[int32]string{
		0: "BIT_WIDTH_UNSPECIFIED",
		1: "BIT_WIDTH_4",
		2: "BIT_WIDTH_8",
		3: "BIT_WIDTH_16",
		4: "BIT_WIDTH_32",
	}
	QuantizationComponentSpec_BitWidth_value = map[string]int32{
		"BIT_WIDTH_UNSPECIFIED": 0,
		"BIT_WIDTH_4":           1,
		"BIT_WIDTH_8":           2,
		"BIT_WIDTH_16":          3,
		"BIT_WIDTH_32":          4,
	}
)

Enum value maps for QuantizationComponentSpec_BitWidth.

View Source
var (
	QuantizationComponentSpec_BitType_name = map[int32]string{
		0: "BIT_TYPE_UNSPECIFIED",
		1: "BIT_TYPE_INT",
		2: "BIT_TYPE_FLOAT",
		3: "BIT_TYPE_BFLOAT",
	}
	QuantizationComponentSpec_BitType_value = map[string]int32{
		"BIT_TYPE_UNSPECIFIED": 0,
		"BIT_TYPE_INT":         1,
		"BIT_TYPE_FLOAT":       2,
		"BIT_TYPE_BFLOAT":      3,
	}
)

Enum value maps for QuantizationComponentSpec_BitType.

View Source
var File_tensorflow_compiler_mlir_quantization_stablehlo_quantization_options_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type CustomQuantizationMethod

type CustomQuantizationMethod struct {

	// Specify component name, bit width, and other specs for all compoenents
	// intended to be quantized.
	QuantizationComponentSpec []*QuantizationComponentSpec `` /* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

Custom option for specifying quantization spec details. If the selected quantization option is not available, StableHLO quantizer will raise an error. NEXT ID: 2

func (*CustomQuantizationMethod) Descriptor deprecated

func (*CustomQuantizationMethod) Descriptor() ([]byte, []int)

Deprecated: Use CustomQuantizationMethod.ProtoReflect.Descriptor instead.

func (*CustomQuantizationMethod) GetQuantizationComponentSpec

func (x *CustomQuantizationMethod) GetQuantizationComponentSpec() []*QuantizationComponentSpec

func (*CustomQuantizationMethod) ProtoMessage

func (*CustomQuantizationMethod) ProtoMessage()

func (*CustomQuantizationMethod) ProtoReflect

func (x *CustomQuantizationMethod) ProtoReflect() protoreflect.Message

func (*CustomQuantizationMethod) Reset

func (x *CustomQuantizationMethod) Reset()

func (*CustomQuantizationMethod) String

func (x *CustomQuantizationMethod) String() string

type PresetQuantizationMethod

type PresetQuantizationMethod struct {
	PresetMethod PresetQuantizationMethod_PresetMethod `` /* 164-byte string literal not displayed */
	// contains filtered or unexported fields
}

Preset model quantization method for optimization.

Common quantization methods are defined as preset methods in this message. Note that the quantization specs (ex: bit width) for preset quantization methods are fixed. To use a different quantization spec for a given method, use CustomQuantizationMethod. NEXT ID: 2

func (*PresetQuantizationMethod) Descriptor deprecated

func (*PresetQuantizationMethod) Descriptor() ([]byte, []int)

Deprecated: Use PresetQuantizationMethod.ProtoReflect.Descriptor instead.

func (*PresetQuantizationMethod) GetPresetMethod

func (*PresetQuantizationMethod) ProtoMessage

func (*PresetQuantizationMethod) ProtoMessage()

func (*PresetQuantizationMethod) ProtoReflect

func (x *PresetQuantizationMethod) ProtoReflect() protoreflect.Message

func (*PresetQuantizationMethod) Reset

func (x *PresetQuantizationMethod) Reset()

func (*PresetQuantizationMethod) String

func (x *PresetQuantizationMethod) String() string

type PresetQuantizationMethod_PresetMethod

type PresetQuantizationMethod_PresetMethod int32

Preset quantization methods that are supported as a stable API. NEXT ID: 5

const (
	// TODO(b/266173150): Update preset methods after redefining quantization
	// pattern matching in DarwiNN.
	// This should never be used. Using this will generally result in an error.
	PresetQuantizationMethod_METHOD_UNSPECIFIED PresetQuantizationMethod_PresetMethod = 0 // go/do-include-enum-unspecified
	// Apply default weight-only quantization. Weights are quantized during
	// conversion, then dequantized during inference.
	// Activation: f32, Weight: qi8, Bias: f32
	PresetQuantizationMethod_WEIGHT_ONLY PresetQuantizationMethod_PresetMethod = 1
	// Apply default dynamic range quantization. Quantized tensor value's
	// ranges are determined during graph runtime.
	// Activation: f32, Weight: qi8, Bias: f32
	PresetQuantizationMethod_POST_TRAINING_QUANTIZATION_DYNAMIC_RANGE PresetQuantizationMethod_PresetMethod = 2
	// Apply float16 quantization to all the weights. Quantized weights will be
	// dequantized before running inference.
	// Activation: f32, Weight: f16, Bias: f16
	PresetQuantizationMethod_FLOAT16 PresetQuantizationMethod_PresetMethod = 3
	// Apply static range quantization. The quantization range is determined
	// via calibration phase and quantized during conversion.
	// Activation: qi8, Weight: qi8, Bias: qi32
	PresetQuantizationMethod_POST_TRAINING_QUANTIZATION_STATIC_RANGE PresetQuantizationMethod_PresetMethod = 4
)

func (PresetQuantizationMethod_PresetMethod) Descriptor

func (PresetQuantizationMethod_PresetMethod) Enum

func (PresetQuantizationMethod_PresetMethod) EnumDescriptor deprecated

func (PresetQuantizationMethod_PresetMethod) EnumDescriptor() ([]byte, []int)

Deprecated: Use PresetQuantizationMethod_PresetMethod.Descriptor instead.

func (PresetQuantizationMethod_PresetMethod) Number

func (PresetQuantizationMethod_PresetMethod) String

func (PresetQuantizationMethod_PresetMethod) Type

type QuantizationComponentSpec

type QuantizationComponentSpec struct {
	QuantizationComponent QuantizationComponentSpec_QuantizationComponent `` /* 201-byte string literal not displayed */
	// Defines the target bit of the data.
	BitWidth QuantizationComponentSpec_BitWidth `` /* 149-byte string literal not displayed */
	// Defines the type of data of the quantized component.
	BitType QuantizationComponentSpec_BitType `` /* 145-byte string literal not displayed */
	// Defines whether quantization is done in narrow range.
	EnableNarrowRange bool `protobuf:"varint,4,opt,name=enable_narrow_range,json=enableNarrowRange,proto3" json:"enable_narrow_range,omitempty"`
	// Defines whether quantiation is done per-channel.
	EnablePerChannelQuantization bool `` /* 150-byte string literal not displayed */
	// Defines whether quantization is done symmetrically.
	EnableSymmetric bool `protobuf:"varint,6,opt,name=enable_symmetric,json=enableSymmetric,proto3" json:"enable_symmetric,omitempty"`
	// contains filtered or unexported fields
}

Quantization spec per each component designated to be quantized. Components whose QuantizationComponentSpec is not specified will not be quantized, and remain f32. NEXT ID: 7

func (*QuantizationComponentSpec) Descriptor deprecated

func (*QuantizationComponentSpec) Descriptor() ([]byte, []int)

Deprecated: Use QuantizationComponentSpec.ProtoReflect.Descriptor instead.

func (*QuantizationComponentSpec) GetBitType

func (*QuantizationComponentSpec) GetBitWidth

func (*QuantizationComponentSpec) GetEnableNarrowRange

func (x *QuantizationComponentSpec) GetEnableNarrowRange() bool

func (*QuantizationComponentSpec) GetEnablePerChannelQuantization

func (x *QuantizationComponentSpec) GetEnablePerChannelQuantization() bool

func (*QuantizationComponentSpec) GetEnableSymmetric

func (x *QuantizationComponentSpec) GetEnableSymmetric() bool

func (*QuantizationComponentSpec) GetQuantizationComponent

func (*QuantizationComponentSpec) ProtoMessage

func (*QuantizationComponentSpec) ProtoMessage()

func (*QuantizationComponentSpec) ProtoReflect

func (*QuantizationComponentSpec) Reset

func (x *QuantizationComponentSpec) Reset()

func (*QuantizationComponentSpec) String

func (x *QuantizationComponentSpec) String() string

type QuantizationComponentSpec_BitType

type QuantizationComponentSpec_BitType int32

NEXT ID: 4

const (
	QuantizationComponentSpec_BIT_TYPE_UNSPECIFIED QuantizationComponentSpec_BitType = 0
	QuantizationComponentSpec_BIT_TYPE_INT         QuantizationComponentSpec_BitType = 1
	QuantizationComponentSpec_BIT_TYPE_FLOAT       QuantizationComponentSpec_BitType = 2
	QuantizationComponentSpec_BIT_TYPE_BFLOAT      QuantizationComponentSpec_BitType = 3
)

func (QuantizationComponentSpec_BitType) Descriptor

func (QuantizationComponentSpec_BitType) Enum

func (QuantizationComponentSpec_BitType) EnumDescriptor deprecated

func (QuantizationComponentSpec_BitType) EnumDescriptor() ([]byte, []int)

Deprecated: Use QuantizationComponentSpec_BitType.Descriptor instead.

func (QuantizationComponentSpec_BitType) Number

func (QuantizationComponentSpec_BitType) String

func (QuantizationComponentSpec_BitType) Type

type QuantizationComponentSpec_BitWidth

type QuantizationComponentSpec_BitWidth int32

NEXT ID: 5

const (
	QuantizationComponentSpec_BIT_WIDTH_UNSPECIFIED QuantizationComponentSpec_BitWidth = 0
	QuantizationComponentSpec_BIT_WIDTH_4           QuantizationComponentSpec_BitWidth = 1
	QuantizationComponentSpec_BIT_WIDTH_8           QuantizationComponentSpec_BitWidth = 2
	QuantizationComponentSpec_BIT_WIDTH_16          QuantizationComponentSpec_BitWidth = 3
	QuantizationComponentSpec_BIT_WIDTH_32          QuantizationComponentSpec_BitWidth = 4
)

func (QuantizationComponentSpec_BitWidth) Descriptor

func (QuantizationComponentSpec_BitWidth) Enum

func (QuantizationComponentSpec_BitWidth) EnumDescriptor deprecated

func (QuantizationComponentSpec_BitWidth) EnumDescriptor() ([]byte, []int)

Deprecated: Use QuantizationComponentSpec_BitWidth.Descriptor instead.

func (QuantizationComponentSpec_BitWidth) Number

func (QuantizationComponentSpec_BitWidth) String

func (QuantizationComponentSpec_BitWidth) Type

type QuantizationComponentSpec_QuantizationComponent

type QuantizationComponentSpec_QuantizationComponent int32

NEXT ID: 4

const (
	QuantizationComponentSpec_COMPONENT_UNSPECIFIED QuantizationComponentSpec_QuantizationComponent = 0
	QuantizationComponentSpec_COMPONENT_ACTIVATION  QuantizationComponentSpec_QuantizationComponent = 1
	QuantizationComponentSpec_COMPONENT_WEIGHT      QuantizationComponentSpec_QuantizationComponent = 2
	QuantizationComponentSpec_COMPONENT_BIAS        QuantizationComponentSpec_QuantizationComponent = 3
)

func (QuantizationComponentSpec_QuantizationComponent) Descriptor

func (QuantizationComponentSpec_QuantizationComponent) Enum

func (QuantizationComponentSpec_QuantizationComponent) EnumDescriptor deprecated

Deprecated: Use QuantizationComponentSpec_QuantizationComponent.Descriptor instead.

func (QuantizationComponentSpec_QuantizationComponent) Number

func (QuantizationComponentSpec_QuantizationComponent) String

func (QuantizationComponentSpec_QuantizationComponent) Type

type QuantizationMethod

type QuantizationMethod struct {

	// Quantization Method can be either preset or custom.
	//
	// Types that are assignable to QuantizationMethod:
	//
	//	*QuantizationMethod_PresetQuantizationMethod
	//	*QuantizationMethod_CustomQuantizationMethod
	QuantizationMethod isQuantizationMethod_QuantizationMethod `protobuf_oneof:"quantization_method"`
	// contains filtered or unexported fields
}

NEXT ID: 3

func (*QuantizationMethod) Descriptor deprecated

func (*QuantizationMethod) Descriptor() ([]byte, []int)

Deprecated: Use QuantizationMethod.ProtoReflect.Descriptor instead.

func (*QuantizationMethod) GetCustomQuantizationMethod

func (x *QuantizationMethod) GetCustomQuantizationMethod() *CustomQuantizationMethod

func (*QuantizationMethod) GetPresetQuantizationMethod

func (x *QuantizationMethod) GetPresetQuantizationMethod() *PresetQuantizationMethod

func (*QuantizationMethod) GetQuantizationMethod

func (m *QuantizationMethod) GetQuantizationMethod() isQuantizationMethod_QuantizationMethod

func (*QuantizationMethod) ProtoMessage

func (*QuantizationMethod) ProtoMessage()

func (*QuantizationMethod) ProtoReflect

func (x *QuantizationMethod) ProtoReflect() protoreflect.Message

func (*QuantizationMethod) Reset

func (x *QuantizationMethod) Reset()

func (*QuantizationMethod) String

func (x *QuantizationMethod) String() string

type QuantizationMethod_CustomQuantizationMethod

type QuantizationMethod_CustomQuantizationMethod struct {
	CustomQuantizationMethod *CustomQuantizationMethod `protobuf:"bytes,2,opt,name=custom_quantization_method,json=customQuantizationMethod,proto3,oneof"`
}

type QuantizationMethod_PresetQuantizationMethod

type QuantizationMethod_PresetQuantizationMethod struct {
	PresetQuantizationMethod *PresetQuantizationMethod `protobuf:"bytes,1,opt,name=preset_quantization_method,json=presetQuantizationMethod,proto3,oneof"`
}

type QuantizationOptions

type QuantizationOptions struct {
	QuantizationMethod *QuantizationMethod `protobuf:"bytes,1,opt,name=quantization_method,json=quantizationMethod,proto3" json:"quantization_method,omitempty"`
	// contains filtered or unexported fields
}

Defines arious options to specify and control the behavior of the StableHLO quantizer. NEXT ID: 2

func (*QuantizationOptions) Descriptor deprecated

func (*QuantizationOptions) Descriptor() ([]byte, []int)

Deprecated: Use QuantizationOptions.ProtoReflect.Descriptor instead.

func (*QuantizationOptions) GetQuantizationMethod

func (x *QuantizationOptions) GetQuantizationMethod() *QuantizationMethod

func (*QuantizationOptions) ProtoMessage

func (*QuantizationOptions) ProtoMessage()

func (*QuantizationOptions) ProtoReflect

func (x *QuantizationOptions) ProtoReflect() protoreflect.Message

func (*QuantizationOptions) Reset

func (x *QuantizationOptions) Reset()

func (*QuantizationOptions) String

func (x *QuantizationOptions) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL