mlcompute

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Rendered for darwin/amd64

Overview

Package mlcompute provides purego-based Go bindings for the macOS MLCompute framework.

Apple documentation: https://developer.apple.com/documentation/mlcompute

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MLCActivationTypeDebugDescription

func MLCActivationTypeDebugDescription(activationType MLCActivationType) *foundation.NSString

@abstract Returns a textual description of the activation type, suitable for debugging.

func MLCArithmeticOperationDebugDescription

func MLCArithmeticOperationDebugDescription(operation MLCArithmeticOperation) *foundation.NSString

@abstract Returns a textual description of the arithmetic operation, suitable for debugging.

func MLCComparisonOperationDebugDescription

func MLCComparisonOperationDebugDescription(operation MLCComparisonOperation) *foundation.NSString

@abstract Returns a textual description of the comparison operation, suitable for debugging.

func MLCConvolutionTypeDebugDescription

func MLCConvolutionTypeDebugDescription(convolutionType MLCConvolutionType) *foundation.NSString

@abstract Returns a textual description of the convolution type, suitable for debugging.

func MLCGradientClippingTypeDebugDescription

func MLCGradientClippingTypeDebugDescription(gradientClippingType MLCGradientClippingType) *foundation.NSString

@abstract Returns a textual description of the gradient clipping type, suitable for debugging.

func MLCLSTMResultModeDebugDescription

func MLCLSTMResultModeDebugDescription(mode MLCLSTMResultMode) *foundation.NSString

@abstract Returns a textual description of the LSTM result mode, suitable for debugging.

func MLCLayerSupportsDataTypeOnDevice

func MLCLayerSupportsDataTypeOnDevice(dataType MLCDataType, device *MLCDevice) bool

@abstract Determine whether instances of this layer accept source tensors of the given data type on the given device. @param dataType A data type of a possible input tensor to the layer @param device A device @return A boolean indicating whether the data type is supported

func MLCLossTypeDebugDescription

func MLCLossTypeDebugDescription(lossType MLCLossType) *foundation.NSString

@abstract Returns a textual description of the loss type, suitable for debugging.

func MLCPaddingPolicyDebugDescription

func MLCPaddingPolicyDebugDescription(paddingPolicy MLCPaddingPolicy) *foundation.NSString

@abstract Returns a textual description of the padding policy, suitable for debugging.

func MLCPaddingTypeDebugDescription

func MLCPaddingTypeDebugDescription(paddingType MLCPaddingType) *foundation.NSString

@abstract Returns a textual description of the padding type, suitable for debugging.

func MLCPlatformGetRNGseed

func MLCPlatformGetRNGseed() *foundation.NSNumber

@method getRNGseed @abstract gets the RNG seed value. If the value is not set it would return nil

func MLCPlatformSetRNGSeedTo

func MLCPlatformSetRNGSeedTo(seed *foundation.NSNumber)

@method setRNGSeedTo @abstract sets the RNG seed. The seed should be of type long int.

func MLCPoolingTypeDebugDescription

func MLCPoolingTypeDebugDescription(poolingType MLCPoolingType) *foundation.NSString

@abstract Returns a textual description of the pooling type, suitable for debugging.

func MLCReductionTypeDebugDescription

func MLCReductionTypeDebugDescription(reductionType MLCReductionType) *foundation.NSString

@abstract Returns a textual description of the reduction type, suitable for debugging.

func MLCSampleModeDebugDescription

func MLCSampleModeDebugDescription(mode MLCSampleMode) *foundation.NSString

@abstract Returns a textual description of the sample mode, suitable for debugging.

func MLCSoftmaxOperationDebugDescription

func MLCSoftmaxOperationDebugDescription(operation MLCSoftmaxOperation) *foundation.NSString

@abstract Returns a textual description of the softmax operation, suitable for debugging.

func MLCTensorDescriptorMaxTensorDimensions

func MLCTensorDescriptorMaxTensorDimensions() uint

@property maxTensorDimensions @abstract The maximum number of tensor dimensions supported

func SymbolAvailable

func SymbolAvailable(symbol string) bool

SymbolAvailable reports whether the named C symbol was bound when the library loaded. Calling a generated wrapper whose symbol is unavailable dereferences a nil function variable and panics.

Types

type Acl_entry_id_t

type Acl_entry_id_t int64
const (
	ACL_FIRST_ENTRY Acl_entry_id_t = 0
	ACL_NEXT_ENTRY  Acl_entry_id_t = -1
	ACL_LAST_ENTRY  Acl_entry_id_t = -2
)

func (Acl_entry_id_t) String

func (e Acl_entry_id_t) String() string

type Acl_flag_t

type Acl_flag_t int64
const (
	ACL_FLAG_DEFER_INHERIT      Acl_flag_t = 1
	ACL_FLAG_NO_INHERIT         Acl_flag_t = 131072
	ACL_ENTRY_INHERITED         Acl_flag_t = 16
	ACL_ENTRY_FILE_INHERIT      Acl_flag_t = 32
	ACL_ENTRY_DIRECTORY_INHERIT Acl_flag_t = 64
	ACL_ENTRY_LIMIT_INHERIT     Acl_flag_t = 128
	ACL_ENTRY_ONLY_INHERIT      Acl_flag_t = 256
)

func (Acl_flag_t) String

func (e Acl_flag_t) String() string

type Acl_perm_t

type Acl_perm_t int64
const (
	ACL_READ_DATA           Acl_perm_t = 2
	ACL_LIST_DIRECTORY      Acl_perm_t = 2
	ACL_WRITE_DATA          Acl_perm_t = 4
	ACL_ADD_FILE            Acl_perm_t = 4
	ACL_EXECUTE             Acl_perm_t = 8
	ACL_SEARCH              Acl_perm_t = 8
	ACL_DELETE              Acl_perm_t = 16
	ACL_APPEND_DATA         Acl_perm_t = 32
	ACL_ADD_SUBDIRECTORY    Acl_perm_t = 32
	ACL_DELETE_CHILD        Acl_perm_t = 64
	ACL_READ_ATTRIBUTES     Acl_perm_t = 128
	ACL_WRITE_ATTRIBUTES    Acl_perm_t = 256
	ACL_READ_EXTATTRIBUTES  Acl_perm_t = 512
	ACL_WRITE_EXTATTRIBUTES Acl_perm_t = 1024
	ACL_READ_SECURITY       Acl_perm_t = 2048
	ACL_WRITE_SECURITY      Acl_perm_t = 4096
	ACL_CHANGE_OWNER        Acl_perm_t = 8192
	ACL_SYNCHRONIZE         Acl_perm_t = 1048576
)

func (Acl_perm_t) String

func (e Acl_perm_t) String() string

type Acl_tag_t

type Acl_tag_t int64
const (
	ACL_UNDEFINED_TAG  Acl_tag_t = 0
	ACL_EXTENDED_ALLOW Acl_tag_t = 1
	ACL_EXTENDED_DENY  Acl_tag_t = 2
)

func (Acl_tag_t) String

func (e Acl_tag_t) String() string

type Acl_type_t

type Acl_type_t int64
const (
	ACL_TYPE_EXTENDED Acl_type_t = 256
	ACL_TYPE_ACCESS   Acl_type_t = 0
	ACL_TYPE_DEFAULT  Acl_type_t = 1
	ACL_TYPE_AFS      Acl_type_t = 2
	ACL_TYPE_CODA     Acl_type_t = 3
	ACL_TYPE_NTFS     Acl_type_t = 4
	ACL_TYPE_NWFS     Acl_type_t = 5
)

func (Acl_type_t) String

func (e Acl_type_t) String() string

type Clockid_t

type Clockid_t int64

func (Clockid_t) String

func (e Clockid_t) String() string

type Dispatch_autorelease_frequency_t

type Dispatch_autorelease_frequency_t uint64
const (
	DISPATCH_AUTORELEASE_FREQUENCY_INHERIT   Dispatch_autorelease_frequency_t = 0
	DISPATCH_AUTORELEASE_FREQUENCY_WORK_ITEM Dispatch_autorelease_frequency_t = 1
	DISPATCH_AUTORELEASE_FREQUENCY_NEVER     Dispatch_autorelease_frequency_t = 2
)

func (Dispatch_autorelease_frequency_t) String

type Dispatch_block_flags_t

type Dispatch_block_flags_t uint64
const (
	DISPATCH_BLOCK_BARRIER           Dispatch_block_flags_t = 1
	DISPATCH_BLOCK_DETACHED          Dispatch_block_flags_t = 2
	DISPATCH_BLOCK_ASSIGN_CURRENT    Dispatch_block_flags_t = 4
	DISPATCH_BLOCK_NO_QOS_CLASS      Dispatch_block_flags_t = 8
	DISPATCH_BLOCK_INHERIT_QOS_CLASS Dispatch_block_flags_t = 16
	DISPATCH_BLOCK_ENFORCE_QOS_CLASS Dispatch_block_flags_t = 32
)

func (Dispatch_block_flags_t) String

func (e Dispatch_block_flags_t) String() string

type Filesec_property_t

type Filesec_property_t int64
const (
	FILESEC_OWNER         Filesec_property_t = 1
	FILESEC_GROUP         Filesec_property_t = 2
	FILESEC_UUID          Filesec_property_t = 3
	FILESEC_MODE          Filesec_property_t = 4
	FILESEC_ACL           Filesec_property_t = 5
	FILESEC_GRPUUID       Filesec_property_t = 6
	FILESEC_ACL_RAW       Filesec_property_t = 100
	FILESEC_ACL_ALLOCSIZE Filesec_property_t = 101
)

func (Filesec_property_t) String

func (e Filesec_property_t) String() string

type Idtype_t

type Idtype_t int64
const (
	P_ALL  Idtype_t = 0
	P_PID  Idtype_t = 1
	P_PGID Idtype_t = 2
)

func (Idtype_t) String

func (e Idtype_t) String() string

type Ipc_info_object_type_t

type Ipc_info_object_type_t int64
const (
	IPC_OTYPE_NONE                 Ipc_info_object_type_t = 0
	IPC_OTYPE_THREAD_CONTROL       Ipc_info_object_type_t = 1
	IPC_OTYPE_TASK_CONTROL         Ipc_info_object_type_t = 2
	IPC_OTYPE_HOST                 Ipc_info_object_type_t = 3
	IPC_OTYPE_HOST_PRIV            Ipc_info_object_type_t = 4
	IPC_OTYPE_PROCESSOR            Ipc_info_object_type_t = 5
	IPC_OTYPE_PROCESSOR_SET        Ipc_info_object_type_t = 6
	IPC_OTYPE_PROCESSOR_SET_NAME   Ipc_info_object_type_t = 7
	IPC_OTYPE_TIMER                Ipc_info_object_type_t = 8
	IPC_OTYPE_PORT_SUBST_ONCE      Ipc_info_object_type_t = 9
	IPC_OTYPE_MIG                  Ipc_info_object_type_t = 10
	IPC_OTYPE_MEMORY_OBJECT        Ipc_info_object_type_t = 11
	IPC_OTYPE_XMM_PAGER            Ipc_info_object_type_t = 12
	IPC_OTYPE_XMM_KERNEL           Ipc_info_object_type_t = 13
	IPC_OTYPE_XMM_REPLY            Ipc_info_object_type_t = 14
	IPC_OTYPE_UND_REPLY            Ipc_info_object_type_t = 15
	IPC_OTYPE_HOST_NOTIFY          Ipc_info_object_type_t = 16
	IPC_OTYPE_HOST_SECURITY        Ipc_info_object_type_t = 17
	IPC_OTYPE_LEDGER               Ipc_info_object_type_t = 18
	IPC_OTYPE_MAIN_DEVICE          Ipc_info_object_type_t = 19
	IPC_OTYPE_TASK_NAME            Ipc_info_object_type_t = 20
	IPC_OTYPE_SUBSYSTEM            Ipc_info_object_type_t = 21
	IPC_OTYPE_IO_DONE_QUEUE        Ipc_info_object_type_t = 22
	IPC_OTYPE_SEMAPHORE            Ipc_info_object_type_t = 23
	IPC_OTYPE_LOCK_SET             Ipc_info_object_type_t = 24
	IPC_OTYPE_CLOCK                Ipc_info_object_type_t = 25
	IPC_OTYPE_CLOCK_CTRL           Ipc_info_object_type_t = 26
	IPC_OTYPE_IOKIT_IDENT          Ipc_info_object_type_t = 27
	IPC_OTYPE_NAMED_ENTRY          Ipc_info_object_type_t = 28
	IPC_OTYPE_IOKIT_CONNECT        Ipc_info_object_type_t = 29
	IPC_OTYPE_IOKIT_OBJECT         Ipc_info_object_type_t = 30
	IPC_OTYPE_UPL                  Ipc_info_object_type_t = 31
	IPC_OTYPE_MEM_OBJ_CONTROL      Ipc_info_object_type_t = 32
	IPC_OTYPE_AU_SESSIONPORT       Ipc_info_object_type_t = 33
	IPC_OTYPE_FILEPORT             Ipc_info_object_type_t = 34
	IPC_OTYPE_LABELH               Ipc_info_object_type_t = 35
	IPC_OTYPE_TASK_RESUME          Ipc_info_object_type_t = 36
	IPC_OTYPE_VOUCHER              Ipc_info_object_type_t = 37
	IPC_OTYPE_VOUCHER_ATTR_CONTROL Ipc_info_object_type_t = 38
	IPC_OTYPE_WORK_INTERVAL        Ipc_info_object_type_t = 39
	IPC_OTYPE_UX_HANDLER           Ipc_info_object_type_t = 40
	IPC_OTYPE_UEXT_OBJECT          Ipc_info_object_type_t = 41
	IPC_OTYPE_ARCADE_REG           Ipc_info_object_type_t = 42
	IPC_OTYPE_EVENTLINK            Ipc_info_object_type_t = 43
	IPC_OTYPE_TASK_INSPECT         Ipc_info_object_type_t = 44
	IPC_OTYPE_TASK_READ            Ipc_info_object_type_t = 45
	IPC_OTYPE_THREAD_INSPECT       Ipc_info_object_type_t = 46
	IPC_OTYPE_THREAD_READ          Ipc_info_object_type_t = 47
	IPC_OTYPE_SUID_CRED            Ipc_info_object_type_t = 48
	IPC_OTYPE_HYPERVISOR           Ipc_info_object_type_t = 49
	IPC_OTYPE_TASK_ID_TOKEN        Ipc_info_object_type_t = 50
	IPC_OTYPE_TASK_FATAL           Ipc_info_object_type_t = 51
	IPC_OTYPE_KCDATA               Ipc_info_object_type_t = 52
	IPC_OTYPE_EXCLAVES_RESOURCE    Ipc_info_object_type_t = 53
	IPC_OTYPE_THREAD_RESUME        Ipc_info_object_type_t = 54
	IPC_OTYPE_UNKNOWN              Ipc_info_object_type_t = 4294967295
)

func (Ipc_info_object_type_t) String

func (e Ipc_info_object_type_t) String() string

type Launch_data_type_t

type Launch_data_type_t int64
const (
	LAUNCH_DATA_DICTIONARY Launch_data_type_t = 1
	LAUNCH_DATA_ARRAY      Launch_data_type_t = 2
	LAUNCH_DATA_FD         Launch_data_type_t = 3
	LAUNCH_DATA_INTEGER    Launch_data_type_t = 4
	LAUNCH_DATA_REAL       Launch_data_type_t = 5
	LAUNCH_DATA_BOOL       Launch_data_type_t = 6
	LAUNCH_DATA_STRING     Launch_data_type_t = 7
	LAUNCH_DATA_OPAQUE     Launch_data_type_t = 8
	LAUNCH_DATA_ERRNO      Launch_data_type_t = 9
	LAUNCH_DATA_MACHPORT   Launch_data_type_t = 10
)

func (Launch_data_type_t) String

func (e Launch_data_type_t) String() string

type MDLabelDomain

type MDLabelDomain int64

@typedef MDLabelDomain @abstract These constants are used to specify a domain to MDLabelCreate().

const (
	KMDLabelUserDomain  MDLabelDomain = 0
	KMDLabelLocalDomain MDLabelDomain = 1
)

func (MDLabelDomain) String

func (e MDLabelDomain) String() string

type MDQueryOptionFlags

type MDQueryOptionFlags int64
const (
	KMDQuerySynchronous        MDQueryOptionFlags = 1
	KMDQueryWantsUpdates       MDQueryOptionFlags = 4
	KMDQueryAllowFSTranslation MDQueryOptionFlags = 8
)

func (MDQueryOptionFlags) String

func (e MDQueryOptionFlags) String() string

type MDQuerySortOptionFlags

type MDQuerySortOptionFlags int64

@enum MDQuerySortOptionFlags @constant kMDQueryReverseSortOrderFlag Sort the attribute in reverse order.

const (
	KMDQueryReverseSortOrderFlag MDQuerySortOptionFlags = 1
)

func (MDQuerySortOptionFlags) String

func (e MDQuerySortOptionFlags) String() string

type MLCActivationDescriptor

type MLCActivationDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcactivationdescriptor

func MLCActivationDescriptorDescriptorWithType

func MLCActivationDescriptorDescriptorWithType(activationType MLCActivationType) *MLCActivationDescriptor

@abstract Create a MLCActivationDescriptor object @param activationType A type of activation function. @return A new neuron descriptor or nil if failure

func MLCActivationDescriptorDescriptorWithTypeA

func MLCActivationDescriptorDescriptorWithTypeA(activationType MLCActivationType, a float32) *MLCActivationDescriptor

@abstract Create a MLCActivationDescriptor object @param activationType A type of activation function. @param a Parameter "a". @return A new neuron descriptor or nil if failure

func MLCActivationDescriptorDescriptorWithTypeAB

func MLCActivationDescriptorDescriptorWithTypeAB(activationType MLCActivationType, a float32, b float32) *MLCActivationDescriptor

@abstract Create a MLCActivationDescriptor object @param activationType A type of activation function. @param a Parameter "a". @param b Parameter "b". @return A new neuron descriptor or nil if failure

func MLCActivationDescriptorDescriptorWithTypeABC

func MLCActivationDescriptorDescriptorWithTypeABC(activationType MLCActivationType, a float32, b float32, c float32) *MLCActivationDescriptor

@abstract Create a MLCActivationDescriptor object @param activationType A type of activation function. @param a Parameter "a". @param b Parameter "b". @param c Parameter "c". @return A new neuron descriptor or nil if failure

func MLCActivationDescriptorFromID

func MLCActivationDescriptorFromID(id objc.ID) *MLCActivationDescriptor

func (*MLCActivationDescriptor) A

@property a @abstract Parameter to the activation function

func (*MLCActivationDescriptor) ActivationType

func (o *MLCActivationDescriptor) ActivationType() MLCActivationType

@property activationType @abstract The type of activation function

func (*MLCActivationDescriptor) B

@property b @abstract Parameter to the activation function

func (*MLCActivationDescriptor) C

@property c @abstract Parameter to the activation function

type MLCActivationLayer

type MLCActivationLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcactivationlayer

func MLCActivationLayerAbsoluteLayer

func MLCActivationLayerAbsoluteLayer() *MLCActivationLayer

@abstract Create an absolute activation layer @return A new activation layer

func MLCActivationLayerCeluLayer

func MLCActivationLayerCeluLayer() *MLCActivationLayer

@abstract Create a CELU activation layer @return A new activation layer

func MLCActivationLayerCeluLayerWithA

func MLCActivationLayerCeluLayerWithA(a float32) *MLCActivationLayer

@abstract Create a CELU activation layer @param a The \p a value for the CELU formation @return A new activation layer

func MLCActivationLayerClampLayerWithMinValueMaxValue

func MLCActivationLayerClampLayerWithMinValueMaxValue(minValue float32, maxValue float32) *MLCActivationLayer

@abstract Create a clamp activation layer @param minValue The minimum range used by clamp @param maxValue The maximum range used by clamp @return A new activation layer

func MLCActivationLayerEluLayer

func MLCActivationLayerEluLayer() *MLCActivationLayer

@abstract Create an ELU activation layer @return A new activation layer

func MLCActivationLayerEluLayerWithA

func MLCActivationLayerEluLayerWithA(a float32) *MLCActivationLayer

@abstract Create an ELU activation layer @param a The \p a value for the ELU formation @return A new activation layer

func MLCActivationLayerFromID

func MLCActivationLayerFromID(id objc.ID) *MLCActivationLayer

func MLCActivationLayerGeluLayer

func MLCActivationLayerGeluLayer() *MLCActivationLayer

@abstract Create a GELU activation layer @return A new activation layer

func MLCActivationLayerHardShrinkLayer

func MLCActivationLayerHardShrinkLayer() *MLCActivationLayer

@abstract Create a hard shrink activation layer @return A new activation layer

func MLCActivationLayerHardShrinkLayerWithA

func MLCActivationLayerHardShrinkLayerWithA(a float32) *MLCActivationLayer

@abstract Create a hard shrink activation layer @param a The \p a value for the hard shrink formation @return A new activation layer

func MLCActivationLayerHardSigmoidLayer

func MLCActivationLayerHardSigmoidLayer() *MLCActivationLayer

@abstract Create a hard sigmoid activation layer @return A new activation layer

func MLCActivationLayerHardSwishLayer

func MLCActivationLayerHardSwishLayer() *MLCActivationLayer

@abstract Create a hardswish activation layer @return A new activation layer

func MLCActivationLayerLayerWithDescriptor

func MLCActivationLayerLayerWithDescriptor(descriptor *MLCActivationDescriptor) *MLCActivationLayer

@abstract Create an activation layer @param descriptor The activation descriptor @return A new activation layer

func MLCActivationLayerLeakyReLULayer

func MLCActivationLayerLeakyReLULayer() *MLCActivationLayer

@abstract Create a leaky ReLU activation layer @return A new activation layer

func MLCActivationLayerLeakyReLULayerWithNegativeSlope

func MLCActivationLayerLeakyReLULayerWithNegativeSlope(negativeSlope float32) *MLCActivationLayer

@abstract Create a leaky ReLU activation layer @param negativeSlope Controls the angle of the negative slope @return A new activation layer

func MLCActivationLayerLinearLayerWithScaleBias

func MLCActivationLayerLinearLayerWithScaleBias(scale float32, bias float32) *MLCActivationLayer

@abstract Create a linear activation layer @param scale The scale factor @param bias The bias value @return A new activation layer

func MLCActivationLayerLogSigmoidLayer

func MLCActivationLayerLogSigmoidLayer() *MLCActivationLayer

@abstract Create a log sigmoid activation layer @return A new activation layer

func MLCActivationLayerRelu6Layer

func MLCActivationLayerRelu6Layer() *MLCActivationLayer

@abstract Create a ReLU6 activation layer @return A new activation layer

func MLCActivationLayerReluLayer

func MLCActivationLayerReluLayer() *MLCActivationLayer

@abstract Create a ReLU activation layer @return A new activation layer

func MLCActivationLayerRelunLayerWithAB

func MLCActivationLayerRelunLayerWithAB(a float32, b float32) *MLCActivationLayer

@abstract Create a ReLUN activation layer @discussion This can be used to implement layers such as ReLU6 for example. @param a The \p a value @param b The \p b value @return A new activation layer

func MLCActivationLayerSeluLayer

func MLCActivationLayerSeluLayer() *MLCActivationLayer

@abstract Create a SELU activation layer @return A new activation layer

func MLCActivationLayerSigmoidLayer

func MLCActivationLayerSigmoidLayer() *MLCActivationLayer

@abstract Create a sigmoid activation layer @return A new activation layer

func MLCActivationLayerSoftPlusLayer

func MLCActivationLayerSoftPlusLayer() *MLCActivationLayer

@abstract Create a soft plus activation layer @return A new activation layer

func MLCActivationLayerSoftPlusLayerWithBeta

func MLCActivationLayerSoftPlusLayerWithBeta(beta float32) *MLCActivationLayer

@abstract Create a soft plus activation layer @param beta The beta value for the softplus formation @return A new activation layer

func MLCActivationLayerSoftShrinkLayer

func MLCActivationLayerSoftShrinkLayer() *MLCActivationLayer

@abstract Create a soft shrink activation layer @return A new activation layer

func MLCActivationLayerSoftShrinkLayerWithA

func MLCActivationLayerSoftShrinkLayerWithA(a float32) *MLCActivationLayer

@abstract Create a soft shrink activation layer @param a The \p a value for the soft shrink formation @return A new activation layer

func MLCActivationLayerSoftSignLayer

func MLCActivationLayerSoftSignLayer() *MLCActivationLayer

@abstract Create a soft sign activation layer @return A new activation layer

func MLCActivationLayerTanhLayer

func MLCActivationLayerTanhLayer() *MLCActivationLayer

@abstract Create a tanh activation layer @return A new activation layer

func MLCActivationLayerTanhShrinkLayer

func MLCActivationLayerTanhShrinkLayer() *MLCActivationLayer

@abstract Create a TanhShrink activation layer @return A new activation layer

func MLCActivationLayerThresholdLayerWithThresholdReplacement

func MLCActivationLayerThresholdLayerWithThresholdReplacement(threshold float32, replacement float32) *MLCActivationLayer

@abstract Create a threshold activation layer @param threshold The value to threshold at @param replacement The value to replace with @return A new activation layer

func (*MLCActivationLayer) Descriptor

@property descriptor @abstract The activation descriptor

type MLCActivationType

type MLCActivationType int64
const (
	// The identity activation type.
	MLCActivationTypeNone MLCActivationType = 0
	// The ReLU activation type. @discussion This activation type implements the following function: \code f(x) = x >= 0 ? x : a * x \endcode
	MLCActivationTypeReLU MLCActivationType = 1
	// The linear activation type. @discussion This activation type implements the following function: \code f(x) = a * x + b \endcode
	MLCActivationTypeLinear MLCActivationType = 2
	// The sigmoid activation type. @discussion This activation type implements the following function: \code f(x) = 1 / (1 + e⁻ˣ) \endcode
	MLCActivationTypeSigmoid MLCActivationType = 3
	// The hard sigmoid activation type. @discussion This activation type implements the following function: \code f(x) = clamp((x * a) + b, 0, 1) \endcode
	MLCActivationTypeHardSigmoid MLCActivationType = 4
	// The hyperbolic tangent (TanH) activation type. @discussion This activation type implements the following function: \code f(x) = a * tanh(b * x) \endcode
	MLCActivationTypeTanh MLCActivationType = 5
	// The absolute activation type. @discussion This activation type implements the following function: \code f(x) = fabs(x) \endcode
	MLCActivationTypeAbsolute MLCActivationType = 6
	// The parametric soft plus activation type. @discussion This activation type implements the following function: \code f(x) = a * log(1 + e^(b * x)) \endcode
	MLCActivationTypeSoftPlus MLCActivationType = 7
	// The parametric soft sign activation type. @discussion This activation type implements the following function: \code f(x) = x / (1 + abs(x)) \endcod
	MLCActivationTypeSoftSign MLCActivationType = 8
	// The parametric ELU activation type. @discussion This activation type implements the following function: \code f(x) = x >= 0 ? x : a * (exp(x) - 1) \endcode
	MLCActivationTypeELU MLCActivationType = 9
	// The ReLUN activation type. @discussion This activation type implements the following function: \code f(x) = min((x >= 0 ? x : a * x), b) \endcode
	MLCActivationTypeReLUN MLCActivationType = 10
	// The log sigmoid activation type. @discussion This activation type implements the following function: \code f(x) = log(1 / (1 + exp(-x))) \endcode
	MLCActivationTypeLogSigmoid MLCActivationType = 11
	// The SELU activation type. @discussion This activation type implements the following function: \code f(x) = scale * (max(0, x) + min(0, α * (exp(x) − 1))) \endcode where: \code α = 1.6732632423543772848170429916717 scale = 1.0507009873554804934193349852946 \endcode
	MLCActivationTypeSELU MLCActivationType = 12
	// The CELU activation type. @discussion This activation type implements the following function: \code f(x) = max(0, x) + min(0, a * (exp(x / a) − 1)) \endcode
	MLCActivationTypeCELU MLCActivationType = 13
	// The hard shrink activation type. @discussion This activation type implements the following function: \code f(x) = x, if x > a or x < −a, else 0 \endcode
	MLCActivationTypeHardShrink MLCActivationType = 14
	// The soft shrink activation type. @discussion This activation type implements the following function: \code f(x) = x - a, if x > a, x + a, if x < −a, else 0 \endcode
	MLCActivationTypeSoftShrink MLCActivationType = 15
	// The hyperbolic tangent (TanH) shrink activation type. @discussion This activation type implements the following function: \code f(x) = x - tanh(x) \endcode
	MLCActivationTypeTanhShrink MLCActivationType = 16
	// The threshold activation type. @discussion This activation type implements the following function: \code f(x) = x, if x > a, else b \endcode
	MLCActivationTypeThreshold MLCActivationType = 17
	// The GELU activation type. @discussion This activation type implements the following function: \code f(x) = x * CDF(x) \endcode
	MLCActivationTypeGELU MLCActivationType = 18
	// The hardswish activation type. @discussion This activation type implements the following function: \code f(x) = 0, if x <= -3 f(x) = x, if x >= +3 f(x) = x * (x + 3)/6, otherwise \endcode
	MLCActivationTypeHardSwish MLCActivationType = 19
	// The clamp activation type. @discussion This activation type implements the following function: \code f(x) = min(max(x, a), b) \endcode
	MLCActivationTypeClamp MLCActivationType = 20
	MLCActivationTypeCount MLCActivationType = 21
)

func (MLCActivationType) String

func (e MLCActivationType) String() string

type MLCAdamOptimizer

type MLCAdamOptimizer struct {
	MLCOptimizer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcadamoptimizer

func MLCAdamOptimizerFromID

func MLCAdamOptimizerFromID(id objc.ID) *MLCAdamOptimizer

func MLCAdamOptimizerOptimizerWithDescriptor

func MLCAdamOptimizerOptimizerWithDescriptor(optimizerDescriptor *MLCOptimizerDescriptor) *MLCAdamOptimizer

@abstract Create a MLCAdamOptimizer object with defaults @return A new MLCAdamOptimizer object.

func MLCAdamOptimizerOptimizerWithDescriptorBeta1Beta2EpsilonTimeStep

func MLCAdamOptimizerOptimizerWithDescriptorBeta1Beta2EpsilonTimeStep(optimizerDescriptor *MLCOptimizerDescriptor, beta1 float32, beta2 float32, epsilon float32, timeStep uint) *MLCAdamOptimizer

@abstract Create a MLCAdamOptimizer object @param optimizerDescriptor The optimizer descriptor object @param beta1 The beta1 value @param beta2 The beta2 value @param epsilon The epsilon value to use to improve numerical stability @param timeStep The initial timestep to use for the update @return A new MLCAdamOptimizer object.

func MLCAdamOptimizerOptimizerWithDescriptorBeta1Beta2EpsilonUsesAMSGradTimeStep

func MLCAdamOptimizerOptimizerWithDescriptorBeta1Beta2EpsilonUsesAMSGradTimeStep(optimizerDescriptor *MLCOptimizerDescriptor, beta1 float32, beta2 float32, epsilon float32, usesAMSGrad bool, timeStep uint) *MLCAdamOptimizer

@abstract Create a MLCAdamOptimizer object @param optimizerDescriptor The optimizer descriptor object @param beta1 The beta1 value @param beta2 The beta2 value @param epsilon The epsilon value to use to improve numerical stability @param usesAMSGrad Whether to use the AMSGrad variant of this algorithm from the paper (https://arxiv.org/abs/1904.09237) @param timeStep The initial timestep to use for the update @return A new MLCAdamOptimizer object.

func (*MLCAdamOptimizer) Beta1

func (o *MLCAdamOptimizer) Beta1() float32

@property beta1 @abstract Coefficent used for computing running averages of gradient. @discussion The default is 0.9.

func (*MLCAdamOptimizer) Beta2

func (o *MLCAdamOptimizer) Beta2() float32

@property beta2 @abstract Coefficent used for computing running averages of square of gradient. @discussion The default is 0.999.

func (*MLCAdamOptimizer) Epsilon

func (o *MLCAdamOptimizer) Epsilon() float32

func (*MLCAdamOptimizer) TimeStep

func (o *MLCAdamOptimizer) TimeStep() uint

@property timeStep @abstract The current timestep used for the update. @discussion The default is 1.

func (*MLCAdamOptimizer) UsesAMSGrad

func (o *MLCAdamOptimizer) UsesAMSGrad() bool

@property usesAMSGrad @abstract Whether to use the AMSGrad variant of this algorithm @discussion The default is false

type MLCAdamWOptimizer

type MLCAdamWOptimizer struct {
	MLCOptimizer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcadamwoptimizer

func MLCAdamWOptimizerFromID

func MLCAdamWOptimizerFromID(id objc.ID) *MLCAdamWOptimizer

func MLCAdamWOptimizerOptimizerWithDescriptor

func MLCAdamWOptimizerOptimizerWithDescriptor(optimizerDescriptor *MLCOptimizerDescriptor) *MLCAdamWOptimizer

@abstract Create an MLCAdamWOptimizer object with defaults @return A new MLCAdamWOptimizer object.

func MLCAdamWOptimizerOptimizerWithDescriptorBeta1Beta2EpsilonUsesAMSGradTimeStep

func MLCAdamWOptimizerOptimizerWithDescriptorBeta1Beta2EpsilonUsesAMSGradTimeStep(optimizerDescriptor *MLCOptimizerDescriptor, beta1 float32, beta2 float32, epsilon float32, usesAMSGrad bool, timeStep uint) *MLCAdamWOptimizer

@abstract Create an MLCAdamWOptimizer object @param optimizerDescriptor The optimizer descriptor object @param beta1 The beta1 value @param beta2 The beta2 value @param epsilon The epsilon value to use to improve numerical stability @param usesAMSGrad Whether to use the AMSGrad variant of this algorithm from the paper (https://arxiv.org/abs/1904.09237) @param timeStep The initial timestep to use for the update @return A new MLCAdamWOptimizer object.

func (*MLCAdamWOptimizer) Beta1

func (o *MLCAdamWOptimizer) Beta1() float32

@property beta1 @abstract Coefficent used for computing running averages of gradient. @discussion The default is 0.9.

func (*MLCAdamWOptimizer) Beta2

func (o *MLCAdamWOptimizer) Beta2() float32

@property beta2 @abstract Coefficent used for computing running averages of square of gradient. @discussion The default is 0.999.

func (*MLCAdamWOptimizer) Epsilon

func (o *MLCAdamWOptimizer) Epsilon() float32

@property epsilon @abstract A term added to improve numerical stability. @discussion The default is 1e-8.

func (*MLCAdamWOptimizer) TimeStep

func (o *MLCAdamWOptimizer) TimeStep() uint

@property timeStep @abstract The current timestep used for the update. @discussion The default is 1.

func (*MLCAdamWOptimizer) UsesAMSGrad

func (o *MLCAdamWOptimizer) UsesAMSGrad() bool

@property usesAMSGrad @abstract Whether to use the AMSGrad variant of this algorithm @discussion The default is false

type MLCArithmeticLayer

type MLCArithmeticLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcarithmeticlayer

func MLCArithmeticLayerFromID

func MLCArithmeticLayerFromID(id objc.ID) *MLCArithmeticLayer

func MLCArithmeticLayerLayerWithOperation

func MLCArithmeticLayerLayerWithOperation(operation MLCArithmeticOperation) *MLCArithmeticLayer

@abstract Create an arithmetic layer @param operation The arithmetic operation @return A new arithmetic layer

func (*MLCArithmeticLayer) Operation

@property operation @abstract The arithmetic operation.

type MLCArithmeticOperation

type MLCArithmeticOperation int64
const (
	// An operation that calculates the elementwise sum of its two inputs.
	MLCArithmeticOperationAdd MLCArithmeticOperation = 0
	// An operation that calculates the elementwise difference of its two inputs.
	MLCArithmeticOperationSubtract MLCArithmeticOperation = 1
	// An operation that calculates the elementwise product of its two inputs.
	MLCArithmeticOperationMultiply MLCArithmeticOperation = 2
	// An operation that calculates the elementwise division of its two inputs.
	MLCArithmeticOperationDivide MLCArithmeticOperation = 3
	// An operation that calculates the elementwise floor of its two inputs.
	MLCArithmeticOperationFloor MLCArithmeticOperation = 4
	// An operation that calculates the elementwise round of its inputs.
	MLCArithmeticOperationRound MLCArithmeticOperation = 5
	// An operation that calculates the elementwise ceiling of its inputs.
	MLCArithmeticOperationCeil MLCArithmeticOperation = 6
	// An operation that calculates the elementwise square root of its inputs.
	MLCArithmeticOperationSqrt MLCArithmeticOperation = 7
	// An operation that calculates the elementwise reciprocal of the square root of its inputs.
	MLCArithmeticOperationRsqrt MLCArithmeticOperation = 8
	// An operation that calculates the elementwise sine of its inputs.
	MLCArithmeticOperationSin MLCArithmeticOperation = 9
	// An operation that calculates the elementwise cosine of its inputs.
	MLCArithmeticOperationCos MLCArithmeticOperation = 10
	// An operation that calculates the elementwise tangent of its inputs.
	MLCArithmeticOperationTan MLCArithmeticOperation = 11
	// An operation that calculates the elementwise inverse sine of its inputs.
	MLCArithmeticOperationAsin MLCArithmeticOperation = 12
	// An operation that calculates the elementwise inverse cosine of its inputs.
	MLCArithmeticOperationAcos MLCArithmeticOperation = 13
	// An operation that calculates the elementwise inverse tangent of its inputs.
	MLCArithmeticOperationAtan MLCArithmeticOperation = 14
	// An operation that calculates the elementwise hyperbolic sine of its inputs.
	MLCArithmeticOperationSinh MLCArithmeticOperation = 15
	// An operation that calculates the elementwise hyperbolic cosine of its inputs.
	MLCArithmeticOperationCosh MLCArithmeticOperation = 16
	// An operation that calculates the elementwise hyperbolic tangent of its inputs.
	MLCArithmeticOperationTanh MLCArithmeticOperation = 17
	// An operation that calculates the elementwise inverse hyperbolic sine of its inputs.
	MLCArithmeticOperationAsinh MLCArithmeticOperation = 18
	// An operation that calculates the elementwise inverse hyperbolic cosine of its inputs.
	MLCArithmeticOperationAcosh MLCArithmeticOperation = 19
	// An operation that calculates the elementwise inverse hyperbolic tangent of its inputs.
	MLCArithmeticOperationAtanh MLCArithmeticOperation = 20
	// An operation that calculates the elementwise first input raised to the power of its second input.
	MLCArithmeticOperationPow MLCArithmeticOperation = 21
	// An operation that calculates the elementwise result of e raised to the power of its input.
	MLCArithmeticOperationExp MLCArithmeticOperation = 22
	// An operation that calculates the elementwise result of 2 raised to the power of its input.
	MLCArithmeticOperationExp2 MLCArithmeticOperation = 23
	// An operation that calculates the elementwise natural logarithm of its input.
	MLCArithmeticOperationLog MLCArithmeticOperation = 24
	// An operation that calculates the elementwise base 2 logarithm of its input.
	MLCArithmeticOperationLog2 MLCArithmeticOperation = 25
	// An operation that calculates the elementwise product of its two inputs.  Returns 0 if y in x * y is zero, even if x is NaN or INF
	MLCArithmeticOperationMultiplyNoNaN MLCArithmeticOperation = 26
	// An operations that calculates the elementwise division of its two inputs.  Returns 0 if the denominator is 0.
	MLCArithmeticOperationDivideNoNaN MLCArithmeticOperation = 27
	// An operation that calculates the elementwise min of two inputs.
	MLCArithmeticOperationMin MLCArithmeticOperation = 28
	// An operations that calculates the elementwise max of two inputs.
	MLCArithmeticOperationMax   MLCArithmeticOperation = 29
	MLCArithmeticOperationCount MLCArithmeticOperation = 30
)

func (MLCArithmeticOperation) String

func (e MLCArithmeticOperation) String() string

type MLCBatchNormalizationLayer

type MLCBatchNormalizationLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcbatchnormalizationlayer

func MLCBatchNormalizationLayerFromID

func MLCBatchNormalizationLayerFromID(id objc.ID) *MLCBatchNormalizationLayer

func MLCBatchNormalizationLayerLayerWithFeatureChannelCountMeanVarianceBetaGammaVarianceEpsilon

func MLCBatchNormalizationLayerLayerWithFeatureChannelCountMeanVarianceBetaGammaVarianceEpsilon(featureChannelCount uint, mean *MLCTensor, variance *MLCTensor, beta *MLCTensor, gamma *MLCTensor, varianceEpsilon float32) *MLCBatchNormalizationLayer

@abstract Create a batch normalization layer @param featureChannelCount The number of feature channels @param mean The mean tensor @param variance The variance tensor @param beta The beta tensor @param gamma The gamma tensor @param varianceEpsilon The epslion value @return A new batch normalization layer.

func MLCBatchNormalizationLayerLayerWithFeatureChannelCountMeanVarianceBetaGammaVarianceEpsilonMomentum

func MLCBatchNormalizationLayerLayerWithFeatureChannelCountMeanVarianceBetaGammaVarianceEpsilonMomentum(featureChannelCount uint, mean *MLCTensor, variance *MLCTensor, beta *MLCTensor, gamma *MLCTensor, varianceEpsilon float32, momentum float32) *MLCBatchNormalizationLayer

@abstract Create a batch normalization layer @param featureChannelCount The number of feature channels @param mean The mean tensor @param variance The variance tensor @param beta The beta tensor @param gamma The gamma tensor @param varianceEpsilon The epslion value @param momentum The momentum value for the running mean and variance computation @return A new batch normalization layer.

func (*MLCBatchNormalizationLayer) Beta

@property beta @abstract The beta tensor

func (*MLCBatchNormalizationLayer) BetaParameter

func (o *MLCBatchNormalizationLayer) BetaParameter() *MLCTensorParameter

@property betaParameter @abstract The beta tensor parameter used for optimizer update

func (*MLCBatchNormalizationLayer) FeatureChannelCount

func (o *MLCBatchNormalizationLayer) FeatureChannelCount() uint

@property featureChannelCount @abstract The number of feature channels

func (*MLCBatchNormalizationLayer) Gamma

@property gamma @abstract The gamma tensor

func (*MLCBatchNormalizationLayer) GammaParameter

func (o *MLCBatchNormalizationLayer) GammaParameter() *MLCTensorParameter

@property gammaParameter @abstract The gamma tensor parameter used for optimizer update

func (*MLCBatchNormalizationLayer) Mean

@property mean @abstract The mean tensor

func (*MLCBatchNormalizationLayer) Momentum

func (o *MLCBatchNormalizationLayer) Momentum() float32

@property momentum @abstract The value used for the running mean and variance computation @discussion The default is 0.99f.

func (*MLCBatchNormalizationLayer) Variance

func (o *MLCBatchNormalizationLayer) Variance() *MLCTensor

@property variance @abstract The variance tensor

func (*MLCBatchNormalizationLayer) VarianceEpsilon

func (o *MLCBatchNormalizationLayer) VarianceEpsilon() float32

@property varianceEpsilon @abstract A value used for numerical stability

type MLCComparisonLayer

type MLCComparisonLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlccomparisonlayer

func MLCComparisonLayerFromID

func MLCComparisonLayerFromID(id objc.ID) *MLCComparisonLayer

func MLCComparisonLayerLayerWithOperation

func MLCComparisonLayerLayerWithOperation(operation MLCComparisonOperation) *MLCComparisonLayer

@abstract Create a comparison layer. @return A new compare layer.

func (*MLCComparisonLayer) Operation

type MLCComparisonOperation

type MLCComparisonOperation int64
const (
	MLCComparisonOperationEqual          MLCComparisonOperation = 0
	MLCComparisonOperationNotEqual       MLCComparisonOperation = 1
	MLCComparisonOperationLess           MLCComparisonOperation = 2
	MLCComparisonOperationGreater        MLCComparisonOperation = 3
	MLCComparisonOperationLessOrEqual    MLCComparisonOperation = 4
	MLCComparisonOperationGreaterOrEqual MLCComparisonOperation = 5
	MLCComparisonOperationLogicalAND     MLCComparisonOperation = 6
	MLCComparisonOperationLogicalOR      MLCComparisonOperation = 7
	MLCComparisonOperationLogicalNOT     MLCComparisonOperation = 8
	MLCComparisonOperationLogicalNAND    MLCComparisonOperation = 9
	MLCComparisonOperationLogicalNOR     MLCComparisonOperation = 10
	MLCComparisonOperationLogicalXOR     MLCComparisonOperation = 11
	MLCComparisonOperationCount          MLCComparisonOperation = 12
)

func (MLCComparisonOperation) String

func (e MLCComparisonOperation) String() string

type MLCConcatenationLayer

type MLCConcatenationLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcconcatenationlayer

func MLCConcatenationLayerFromID

func MLCConcatenationLayerFromID(id objc.ID) *MLCConcatenationLayer

func MLCConcatenationLayerLayer

func MLCConcatenationLayerLayer() *MLCConcatenationLayer

@abstract Create a concatenation layer @return A new concatenation layer

func MLCConcatenationLayerLayerWithDimension

func MLCConcatenationLayerLayerWithDimension(dimension uint) *MLCConcatenationLayer

@abstract Create a concatenation layer @param dimension The concatenation dimension @return A new concatenation layer

func (*MLCConcatenationLayer) Dimension

func (o *MLCConcatenationLayer) Dimension() uint

@property dimension @abstract The dimension (or axis) along which to concatenate tensors @discussion The default value is 1 (which typically represents features channels)

type MLCConvolutionDescriptor

type MLCConvolutionDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcconvolutiondescriptor

func MLCConvolutionDescriptorConvolutionTransposeDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountGroupCountStridesDilationRatesPaddingPolicyPaddingSizes

func MLCConvolutionDescriptorConvolutionTransposeDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountGroupCountStridesDilationRatesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], inputFeatureChannelCount uint, outputFeatureChannelCount uint, groupCount uint, strides *foundation.NSArray[*foundation.NSNumber], dilationRates *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object for convolution transpose @param kernelSizes The kernel sizes in x and y @param inputFeatureChannelCount The number of feature channels in the input tensor @param outputFeatureChannelCount The number of feature channels in the output tensor @param groupCount Number of groups @param strides The kernel strides in x and y @param dilationRates The dilation rates in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorConvolutionTransposeDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountStridesPaddingPolicyPaddingSizes

func MLCConvolutionDescriptorConvolutionTransposeDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountStridesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], inputFeatureChannelCount uint, outputFeatureChannelCount uint, strides *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object for convolution transpose @param kernelSizes The kernel sizes in x and y @param inputFeatureChannelCount The number of feature channels in the input tensor @param outputFeatureChannelCount The number of feature channels in the output tensor @param strides The kernel strides in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorConvolutionTransposeDescriptorWithKernelWidthKernelHeightInputFeatureChannelCountOutputFeatureChannelCount

func MLCConvolutionDescriptorConvolutionTransposeDescriptorWithKernelWidthKernelHeightInputFeatureChannelCountOutputFeatureChannelCount(kernelWidth uint, kernelHeight uint, inputFeatureChannelCount uint, outputFeatureChannelCount uint) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object for convolution transpose @param kernelWidth The kernel size in x @param kernelHeight The kernel size in x @param inputFeatureChannelCount The number of feature channels in the input tensor @param outputFeatureChannelCount The number of feature channels in the output tensor @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorDepthwiseConvolutionDescriptorWithKernelSizesInputFeatureChannelCountChannelMultiplierStridesDilationRatesPaddingPolicyPaddingSizes

func MLCConvolutionDescriptorDepthwiseConvolutionDescriptorWithKernelSizesInputFeatureChannelCountChannelMultiplierStridesDilationRatesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], inputFeatureChannelCount uint, channelMultiplier uint, strides *foundation.NSArray[*foundation.NSNumber], dilationRates *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object for depthwise convolution @param kernelSizes The kernel sizes in x and y @param inputFeatureChannelCount The number of feature channels in the input tensor @param channelMultiplier The channel multiplier @param strides The kernel strides in x and y @param dilationRates The dilation rates in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorDepthwiseConvolutionDescriptorWithKernelSizesInputFeatureChannelCountChannelMultiplierStridesPaddingPolicyPaddingSizes

func MLCConvolutionDescriptorDepthwiseConvolutionDescriptorWithKernelSizesInputFeatureChannelCountChannelMultiplierStridesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], inputFeatureChannelCount uint, channelMultiplier uint, strides *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object for depthwise convolution @param kernelSizes The kernel sizes in x and y @param inputFeatureChannelCount The number of feature channels in the input tensor @param channelMultiplier The channel multiplier @param strides The kernel strides in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorDepthwiseConvolutionDescriptorWithKernelWidthKernelHeightInputFeatureChannelCountChannelMultiplier

func MLCConvolutionDescriptorDepthwiseConvolutionDescriptorWithKernelWidthKernelHeightInputFeatureChannelCountChannelMultiplier(kernelWidth uint, kernelHeight uint, inputFeatureChannelCount uint, channelMultiplier uint) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object for depthwise convolution @param kernelWidth The kernel size in x @param kernelHeight The kernel size in x @param inputFeatureChannelCount The number of feature channels in the input tensor @param channelMultiplier The channel multiplier @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountGroupCountStridesDilationRatesPaddingPolicyPaddingSizes

func MLCConvolutionDescriptorDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountGroupCountStridesDilationRatesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], inputFeatureChannelCount uint, outputFeatureChannelCount uint, groupCount uint, strides *foundation.NSArray[*foundation.NSNumber], dilationRates *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object @param kernelSizes The kernel sizes in x and y @param inputFeatureChannelCount The number of feature channels in the input tensor @param outputFeatureChannelCount The number of feature channels in the output tensor @param groupCount Number of groups @param strides The kernel strides in x and y @param dilationRates The dilation rates in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountStridesPaddingPolicyPaddingSizes

func MLCConvolutionDescriptorDescriptorWithKernelSizesInputFeatureChannelCountOutputFeatureChannelCountStridesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], inputFeatureChannelCount uint, outputFeatureChannelCount uint, strides *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object @param kernelSizes The kernel sizes in x and y @param inputFeatureChannelCount The number of feature channels in the input tensor @param outputFeatureChannelCount The number of feature channels in the output tensor @param strides The kernel strides in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorDescriptorWithKernelWidthKernelHeightInputFeatureChannelCountOutputFeatureChannelCount

func MLCConvolutionDescriptorDescriptorWithKernelWidthKernelHeightInputFeatureChannelCountOutputFeatureChannelCount(kernelWidth uint, kernelHeight uint, inputFeatureChannelCount uint, outputFeatureChannelCount uint) *MLCConvolutionDescriptor

@abstract Create a MLCConvolutionDescriptor object @param kernelWidth The kernel size in x @param kernelHeight The kernel size in x @param inputFeatureChannelCount The number of feature channels in the input tensor @param outputFeatureChannelCount The number of feature channels in the output tensor @return A new MLCConvolutionDescriptor object.

func MLCConvolutionDescriptorDescriptorWithTypeKernelSizesInputFeatureChannelCountOutputFeatureChannelCountGroupCountStridesDilationRatesPaddingPolicyPaddingSizes

func MLCConvolutionDescriptorDescriptorWithTypeKernelSizesInputFeatureChannelCountOutputFeatureChannelCountGroupCountStridesDilationRatesPaddingPolicyPaddingSizes(convolutionType MLCConvolutionType, kernelSizes *foundation.NSArray[*foundation.NSNumber], inputFeatureChannelCount uint, outputFeatureChannelCount uint, groupCount uint, strides *foundation.NSArray[*foundation.NSNumber], dilationRates *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCConvolutionDescriptor

@abstract Creates a convolution descriptor with the specified convolution type. @param convolutionType The type of convolution. @param kernelSizes The kernel sizes in x and y. @param inputFeatureChannelCount The number of feature channels in the input tensor. @param outputFeatureChannelCount The number of feature channels in the output tensor. When the convolution type is \p MLCConvolutionTypeDepthwise , this value must be a multiple of \p inputFeatureChannelCount . @param groupCount The number of groups. @param strides The kernel strides in x and y. @param dilationRates The dilation rates in x and y. @param paddingPolicy The padding policy. @param paddingSizes The padding sizes in x and y if padding policy is \p MLCPaddingPolicyUsePaddingSize . @return A new convolution descriptor.

func MLCConvolutionDescriptorFromID

func MLCConvolutionDescriptorFromID(id objc.ID) *MLCConvolutionDescriptor

func (*MLCConvolutionDescriptor) ConvolutionType

func (o *MLCConvolutionDescriptor) ConvolutionType() MLCConvolutionType

@property convolutionType @abstract The type of convolution.

func (*MLCConvolutionDescriptor) DilationRateInX

func (o *MLCConvolutionDescriptor) DilationRateInX() uint

@property dilationRateInX @abstract The dilation rate i.e. stride of elements in the kernel in x.

func (*MLCConvolutionDescriptor) DilationRateInY

func (o *MLCConvolutionDescriptor) DilationRateInY() uint

@property dilationRateInY @abstract The dilation rate i.e. stride of elements in the kernel in y.

func (*MLCConvolutionDescriptor) GroupCount

func (o *MLCConvolutionDescriptor) GroupCount() uint

@property groupCount @abstract Number of blocked connections from input channels to output channels

func (*MLCConvolutionDescriptor) InputFeatureChannelCount

func (o *MLCConvolutionDescriptor) InputFeatureChannelCount() uint

@property inputFeatureChannelCount @abstract Number of channels in the input tensor

func (*MLCConvolutionDescriptor) IsConvolutionTranspose

func (o *MLCConvolutionDescriptor) IsConvolutionTranspose() bool

@property isConvolutionTranspose @abstract A flag to indicate if this is a convolution transpose

func (*MLCConvolutionDescriptor) KernelHeight

func (o *MLCConvolutionDescriptor) KernelHeight() uint

@property kernelHeight @abstract The convolution kernel size in y.

func (*MLCConvolutionDescriptor) KernelWidth

func (o *MLCConvolutionDescriptor) KernelWidth() uint

@property kernelWidth @abstract The convolution kernel size in x.

func (*MLCConvolutionDescriptor) OutputFeatureChannelCount

func (o *MLCConvolutionDescriptor) OutputFeatureChannelCount() uint

@property outputFeatureChannelCount @abstract Number of channels in the output tensor

func (*MLCConvolutionDescriptor) PaddingPolicy

func (o *MLCConvolutionDescriptor) PaddingPolicy() MLCPaddingPolicy

@property paddingPolicy @abstract The padding policy to use.

func (*MLCConvolutionDescriptor) PaddingSizeInX

func (o *MLCConvolutionDescriptor) PaddingSizeInX() uint

@property paddingSizeInX @abstract The pooling size in x (left and right) to use if paddingPolicy is MLCPaddingPolicyUsePaddingSize

func (*MLCConvolutionDescriptor) PaddingSizeInY

func (o *MLCConvolutionDescriptor) PaddingSizeInY() uint

@property paddingSizeInY @abstract The pooling size in y (top and bottom) to use if paddingPolicy is MLCPaddingPolicyUsePaddingSize

func (*MLCConvolutionDescriptor) StrideInX

func (o *MLCConvolutionDescriptor) StrideInX() uint

@property strideInX @abstract The stride of the kernel in x.

func (*MLCConvolutionDescriptor) StrideInY

func (o *MLCConvolutionDescriptor) StrideInY() uint

@property strideInY @abstract The stride of the kernel in y.

func (*MLCConvolutionDescriptor) UsesDepthwiseConvolution

func (o *MLCConvolutionDescriptor) UsesDepthwiseConvolution() bool

@property usesDepthwiseConvolution @abstract A flag to indicate depthwise convolution

type MLCConvolutionLayer

type MLCConvolutionLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcconvolutionlayer

func MLCConvolutionLayerFromID

func MLCConvolutionLayerFromID(id objc.ID) *MLCConvolutionLayer

func MLCConvolutionLayerLayerWithWeightsBiasesDescriptor

func MLCConvolutionLayerLayerWithWeightsBiasesDescriptor(weights *MLCTensor, biases *MLCTensor, descriptor *MLCConvolutionDescriptor) *MLCConvolutionLayer

@abstract Create a convolution layer @param weights The weights tensor @param biases The bias tensor @param descriptor The convolution descriptor @return A new convolution layer.

func (*MLCConvolutionLayer) Biases

func (o *MLCConvolutionLayer) Biases() *MLCTensor

@property biases @abstract The bias tensor used by the convolution layer

func (*MLCConvolutionLayer) BiasesParameter

func (o *MLCConvolutionLayer) BiasesParameter() *MLCTensorParameter

@property biasesParameter @abstract The bias tensor parameter used for optimizer update

func (*MLCConvolutionLayer) Descriptor

@property descriptor @abstract The convolution descriptor

func (*MLCConvolutionLayer) Weights

func (o *MLCConvolutionLayer) Weights() *MLCTensor

@property weights @abstract The weights tensor used by the convolution layer

func (*MLCConvolutionLayer) WeightsParameter

func (o *MLCConvolutionLayer) WeightsParameter() *MLCTensorParameter

@property weightsParameter @abstract The weights tensor parameter used for optimizer update

type MLCConvolutionType

type MLCConvolutionType int64
const (
	// The standard convolution type.
	MLCConvolutionTypeStandard MLCConvolutionType = 0
	// The transposed convolution type.
	MLCConvolutionTypeTransposed MLCConvolutionType = 1
	// The depthwise convolution type.
	MLCConvolutionTypeDepthwise MLCConvolutionType = 2
)

func (MLCConvolutionType) String

func (e MLCConvolutionType) String() string

type MLCDataType

type MLCDataType int64
const (
	MLCDataTypeInvalid MLCDataType = 0
	// The 32-bit floating-point data type.
	MLCDataTypeFloat32 MLCDataType = 1
	// The 16-bit floating-point data type.
	MLCDataTypeFloat16 MLCDataType = 3
	// The Boolean data type.
	MLCDataTypeBoolean MLCDataType = 4
	// The 64-bit integer data type.
	MLCDataTypeInt64 MLCDataType = 5
	// The 32-bit integer data type.
	MLCDataTypeInt32 MLCDataType = 7
	// The 8-bit integer data type.
	MLCDataTypeInt8 MLCDataType = 8
	// The 8-bit unsigned integer data type.
	MLCDataTypeUInt8 MLCDataType = 9
	MLCDataTypeCount MLCDataType = 10
)

func (MLCDataType) String

func (e MLCDataType) String() string

type MLCDevice

type MLCDevice struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcdevice

func MLCDeviceAneDevice

func MLCDeviceAneDevice() *MLCDevice

@abstract Creates a device which uses the Apple Neural Engine, if any. @return A new device, or `nil` if no ANE exists.

func MLCDeviceCpuDevice

func MLCDeviceCpuDevice() *MLCDevice

@abstract Creates a device which uses the CPU. @return A new device.

func MLCDeviceDeviceWithGPUDevices

func MLCDeviceDeviceWithGPUDevices(gpus *foundation.NSArray[metal.MTLDevice]) *MLCDevice

@abstract Create a MLCDevice object @discussion This method can be used by developers to select specific GPUs @param gpus List of Metal devices @return A new device object

func MLCDeviceDeviceWithType

func MLCDeviceDeviceWithType(type_ MLCDeviceType) *MLCDevice

@abstract Create a MLCDevice object @param type A device type @return A new device object

func MLCDeviceDeviceWithTypeSelectsMultipleComputeDevices

func MLCDeviceDeviceWithTypeSelectsMultipleComputeDevices(type_ MLCDeviceType, selectsMultipleComputeDevices bool) *MLCDevice

@abstract Create a MLCDevice object that uses multiple devices if available @param type A device type @param selectsMultipleComputeDevices A boolean to indicate whether to select multiple compute devices @return A new device object

func MLCDeviceFromID

func MLCDeviceFromID(id objc.ID) *MLCDevice

func MLCDeviceGpuDevice

func MLCDeviceGpuDevice() *MLCDevice

@abstract Creates a device which uses a GPU, if any. @return A new device, or `nil` if no GPU exists.

func (*MLCDevice) ActualDeviceType

func (o *MLCDevice) ActualDeviceType() MLCDeviceType

@property actualDeviceType @abstract The specific device selected. @discussion This can be CPU, GPU or ANE. If type is MLCDeviceTypeAny, this property can be used to find out the specific device type that is selected.

func (*MLCDevice) GpuDevices

func (o *MLCDevice) GpuDevices() *foundation.NSArray[metal.MTLDevice]

func (*MLCDevice) Type

func (o *MLCDevice) Type() MLCDeviceType

@property type @abstract The type specified when the device is created @discussion Recommend that developers use MLCDeviceTypeAny as the device type. This will ensure that MLCompute will select the best device to execute the neural network. If developers want to be able to control device selection, they can select CPU or GPU and for the GPU, they can also select a specific Metal device.

type MLCDeviceType

type MLCDeviceType int64
const (
	// The CPU device
	MLCDeviceTypeCPU MLCDeviceType = 0
	// The GPU device.
	MLCDeviceTypeGPU MLCDeviceType = 1
	// The any device type.  When selected, the framework will automatically use the appropriate devices to achieve the best performance.
	MLCDeviceTypeAny MLCDeviceType = 2
	// The  Apple Neural Engine device.  When selected, the framework will use the  Neural Engine to execute all layers that can be executed on it. Layers that cannot be executed on the ANE will run on the CPU or GPU.   The Neural Engine device must be explicitly selected.  MLDeviceTypeAny will not select the Neural Engine device.  In addition, this device can be used with inference graphs only.  This device cannot be used with a training graph or an inference graph that shares layers with a training graph.
	MLCDeviceTypeANE   MLCDeviceType = 3
	MLCDeviceTypeCount MLCDeviceType = 4
)

func (MLCDeviceType) String

func (e MLCDeviceType) String() string

type MLCDropoutLayer

type MLCDropoutLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcdropoutlayer

func MLCDropoutLayerFromID

func MLCDropoutLayerFromID(id objc.ID) *MLCDropoutLayer

func MLCDropoutLayerLayerWithRateSeed

func MLCDropoutLayerLayerWithRateSeed(rate float32, seed uint) *MLCDropoutLayer

@abstract Create a dropout layer @param rate A scalar float value. The probability that each element is dropped. @param seed The seed used to generate random numbers. @return A new dropout layer

func (*MLCDropoutLayer) Rate

func (o *MLCDropoutLayer) Rate() float32

@property rate @abstract The probability that each element is dropped

func (*MLCDropoutLayer) Seed

func (o *MLCDropoutLayer) Seed() uint

@property seed @abstract The initial seed used to generate random numbers

type MLCEmbeddingDescriptor

type MLCEmbeddingDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcembeddingdescriptor

func MLCEmbeddingDescriptorDescriptorWithEmbeddingCountEmbeddingDimension

func MLCEmbeddingDescriptorDescriptorWithEmbeddingCountEmbeddingDimension(embeddingCount *foundation.NSNumber, embeddingDimension *foundation.NSNumber) *MLCEmbeddingDescriptor

func MLCEmbeddingDescriptorDescriptorWithEmbeddingCountEmbeddingDimensionPaddingIndexMaximumNormPNormScalesGradientByFrequency

func MLCEmbeddingDescriptorDescriptorWithEmbeddingCountEmbeddingDimensionPaddingIndexMaximumNormPNormScalesGradientByFrequency(embeddingCount *foundation.NSNumber, embeddingDimension *foundation.NSNumber, paddingIndex *foundation.NSNumber, maximumNorm *foundation.NSNumber, pNorm *foundation.NSNumber, scalesGradientByFrequency bool) *MLCEmbeddingDescriptor

func MLCEmbeddingDescriptorFromID

func MLCEmbeddingDescriptorFromID(id objc.ID) *MLCEmbeddingDescriptor

func (*MLCEmbeddingDescriptor) EmbeddingCount

func (o *MLCEmbeddingDescriptor) EmbeddingCount() *foundation.NSNumber

@property embeddingCount @abstract The size of the dictionary

func (*MLCEmbeddingDescriptor) EmbeddingDimension

func (o *MLCEmbeddingDescriptor) EmbeddingDimension() *foundation.NSNumber

@property embeddingDimension @abstract The dimension of embedding vectors

func (*MLCEmbeddingDescriptor) MaximumNorm

func (o *MLCEmbeddingDescriptor) MaximumNorm() *foundation.NSNumber

@property maximumNorm @abstract A float, if set, in the forward pass only, the selected embedding vectors will be re-normalized to have an Lp norm of less than maximumNorm in the dictionary, Default=nil

func (*MLCEmbeddingDescriptor) PNorm

@property pNorm @abstract A float, the p of the Lp norm, can be set to infinity norm by [NSNumber numberWithFloat:INFINITY]. Default=2.0

func (*MLCEmbeddingDescriptor) PaddingIndex

func (o *MLCEmbeddingDescriptor) PaddingIndex() *foundation.NSNumber

@property paddingIndex @abstract If set, the embedding vector at paddingIndex is initialized with zero and will not be updated in gradient pass, Default=nil

func (*MLCEmbeddingDescriptor) ScalesGradientByFrequency

func (o *MLCEmbeddingDescriptor) ScalesGradientByFrequency() bool

@property scalesGradientByFrequency @abstract If set, the gradients are scaled by the inverse of the frequency of the words in batch before the weight update. Default=NO

type MLCEmbeddingLayer

type MLCEmbeddingLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcembeddinglayer

func MLCEmbeddingLayerFromID

func MLCEmbeddingLayerFromID(id objc.ID) *MLCEmbeddingLayer

func MLCEmbeddingLayerLayerWithDescriptorWeights

func MLCEmbeddingLayerLayerWithDescriptorWeights(descriptor *MLCEmbeddingDescriptor, weights *MLCTensor) *MLCEmbeddingLayer

func (*MLCEmbeddingLayer) Descriptor

func (o *MLCEmbeddingLayer) Descriptor() *MLCEmbeddingDescriptor

func (*MLCEmbeddingLayer) Weights

func (o *MLCEmbeddingLayer) Weights() *MLCTensor

@property weights @abstract The array of word embeddings

func (*MLCEmbeddingLayer) WeightsParameter

func (o *MLCEmbeddingLayer) WeightsParameter() *MLCTensorParameter

@property weightsParameter @abstract The weights tensor parameter used for optimizer update

type MLCExecutionOptions

type MLCExecutionOptions int64
const (
	MLCExecutionOptionsNone MLCExecutionOptions = 0
	// The option to skip writing input data to device memory. @discussion this option to prevent writing the input tensors to device memory associated with these tensors when the framework executes the graph.
	MLCExecutionOptionsSkipWritingInputDataToDevice MLCExecutionOptions = 1
	// The option to execute the graph synchronously. @discussion Include this option to wait until execution of the graph on specified device finishes before returning from the \p execute method.
	MLCExecutionOptionsSynchronous MLCExecutionOptions = 2
	// The option to return profiling information in the callback before returning from execution. @discussion Include this option to return profliling information in the graph execute completion handler callback, including device execution time.
	MLCExecutionOptionsProfiling MLCExecutionOptions = 4
	// The option to execute the forward pass for inference only. @discussion If you include this option and execute a training graph using one of the \p execute methods, such as \p -executeWithInputsData:lossLabelsData:lossLabelWeightsData:batchSize:options:completionHandler: , the framework only executes the forward pass of the training graph, and it executes that forward pass for inference only. If you include this option and execute a training graph using one of the executeForward methods, such as \p -executeForwardWithBatchSize:options:completionHandler:), the framework executes the forward pass for inference only.
	MLCExecutionOptionsForwardForInference MLCExecutionOptions = 8
	// The option to enable additional per layer profiling information currently emitted using signposts. @discussion The option to enable per layer profiling information emitted as signposts. The per layer information can be visualized using the Logging Instrument in Xcode's Instruments. This information may not be available for all MLCDevice.
	MLCExecutionOptionsPerLayerProfiling MLCExecutionOptions = 16
)

func (MLCExecutionOptions) String

func (e MLCExecutionOptions) String() string

type MLCFullyConnectedLayer

type MLCFullyConnectedLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcfullyconnectedlayer

func MLCFullyConnectedLayerFromID

func MLCFullyConnectedLayerFromID(id objc.ID) *MLCFullyConnectedLayer

func MLCFullyConnectedLayerLayerWithWeightsBiasesDescriptor

func MLCFullyConnectedLayerLayerWithWeightsBiasesDescriptor(weights *MLCTensor, biases *MLCTensor, descriptor *MLCConvolutionDescriptor) *MLCFullyConnectedLayer

@abstract Create a fully connected layer @param weights The weights tensor @param biases The bias tensor @param descriptor The convolution descriptor @return A new fully connected layer

func (*MLCFullyConnectedLayer) Biases

func (o *MLCFullyConnectedLayer) Biases() *MLCTensor

@property biases @abstract The bias tensor used by the convolution layer

func (*MLCFullyConnectedLayer) BiasesParameter

func (o *MLCFullyConnectedLayer) BiasesParameter() *MLCTensorParameter

@property biasesParameter @abstract The bias tensor parameter used for optimizer update

func (*MLCFullyConnectedLayer) Descriptor

@property descriptor @abstract The convolution descriptor

func (*MLCFullyConnectedLayer) Weights

func (o *MLCFullyConnectedLayer) Weights() *MLCTensor

@property weights @abstract The weights tensor used by the convolution layer

func (*MLCFullyConnectedLayer) WeightsParameter

func (o *MLCFullyConnectedLayer) WeightsParameter() *MLCTensorParameter

@property weightsParameter @abstract The weights tensor parameter used for optimizer update

type MLCGatherLayer

type MLCGatherLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcgatherlayer

func MLCGatherLayerFromID

func MLCGatherLayerFromID(id objc.ID) *MLCGatherLayer

func MLCGatherLayerLayerWithDimension

func MLCGatherLayerLayerWithDimension(dimension uint) *MLCGatherLayer

@abstract Create a gather layer @param dimension The dimension along which to index @return A new gather layer

func (*MLCGatherLayer) Dimension

func (o *MLCGatherLayer) Dimension() uint

@property dimension @abstract The dimension along which to index

type MLCGradientClippingType

type MLCGradientClippingType int64
const (
	MLCGradientClippingTypeByValue      MLCGradientClippingType = 0
	MLCGradientClippingTypeByNorm       MLCGradientClippingType = 1
	MLCGradientClippingTypeByGlobalNorm MLCGradientClippingType = 2
)

func (MLCGradientClippingType) String

func (e MLCGradientClippingType) String() string

type MLCGramMatrixLayer

type MLCGramMatrixLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcgrammatrixlayer

func MLCGramMatrixLayerFromID

func MLCGramMatrixLayerFromID(id objc.ID) *MLCGramMatrixLayer

func MLCGramMatrixLayerLayerWithScale

func MLCGramMatrixLayerLayerWithScale(scale float32) *MLCGramMatrixLayer

@abstract Create a GramMatrix layer @param scale The scaling factor for the output. @return A new GramMatrix layer

func (*MLCGramMatrixLayer) Scale

func (o *MLCGramMatrixLayer) Scale() float32

@property scale @abstract The scale factor

type MLCGraph

type MLCGraph struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcgraph

func MLCGraphFromID

func MLCGraphFromID(id objc.ID) *MLCGraph

func MLCGraphGraph

func MLCGraphGraph() *MLCGraph

@abstract Creates a new graph. @return A new graph.

func (*MLCGraph) BindAndWriteDataForInputsToDeviceBatchSizeSynchronous

func (o *MLCGraph) BindAndWriteDataForInputsToDeviceBatchSizeSynchronous(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], inputTensors *foundation.NSDictionary[*foundation.NSString, *MLCTensor], device *MLCDevice, batchSize uint, synchronous bool) bool

@abstract Associates data with input tensors. If the device is GPU, also copies the data to the device memory. Returns true if the data is successfully associated with input tensors. @discussion This function should be used if you execute the forward, gradient and optimizer updates independently. Before the forward pass is executed, the inputs should be written to device memory. Similarly, before the gradient pass is executed, the inputs (typically the initial gradient tensor) should be written to device memory. The caller must guarantee the lifetime of the underlying memory of each value of \p inputsData for the entirety of each corresponding input tensor's lifetime. @param inputsData The input data to use to write to device memory @param inputTensors The list of tensors to perform writes on @param device The device @param batchSize The batch size. This should be set to the actual batch size that may be used when we execute the graph and can be a value less than or equal to the batch size specified in the tensor. If set to 0, we use batch size specified in the tensor. @param synchronous Whether to execute the copy to the device synchronously. For performance, asynchronous execution is recommended. @return A Boolean value indicating whether the data is successfully associated with the tensor.

func (*MLCGraph) BindAndWriteDataForInputsToDeviceSynchronous

func (o *MLCGraph) BindAndWriteDataForInputsToDeviceSynchronous(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], inputTensors *foundation.NSDictionary[*foundation.NSString, *MLCTensor], device *MLCDevice, synchronous bool) bool

@abstract Associates data with input tensors. If the device is GPU, also copies the data to the device memory. Returns true if the data is successfully associated with input tensors. @discussion This function should be used if you execute the forward, gradient and optimizer updates independently. Before the forward pass is executed, the inputs should be written to device memory. Similarly, before the gradient pass is executed, the inputs (typically the initial gradient tensor) should be written to device memory. The caller must guarantee the lifetime of the underlying memory of each value of \p inputsData for the entirety of each corresponding input tensor's lifetime. @param inputsData The input data to use to write to device memory @param inputTensors The list of tensors to perform writes on @param device The device @param synchronous Whether to execute the copy to the device synchronously. For performance, asynchronous execution is recommended. @return A Boolean value indicating whether the data is successfully associated with the tensor.

func (*MLCGraph) ConcatenateWithSourcesDimension

func (o *MLCGraph) ConcatenateWithSourcesDimension(sources *foundation.NSArray[*MLCTensor], dimension uint) *MLCTensor

@abstract Add a concat layer to the graph @param sources The source tensors to concatenate @param dimension The concatenation dimension @return A result tensor

func (*MLCGraph) Device

func (o *MLCGraph) Device() *MLCDevice

@abstract The device to be used when compiling and executing a graph

func (*MLCGraph) GatherWithDimensionSourceIndices

func (o *MLCGraph) GatherWithDimensionSourceIndices(dimension uint, source *MLCTensor, indices *MLCTensor) *MLCTensor

@abstract Add a gather layer to the graph @param dimension The dimension along which to index @param source The source tensor @param indices The index of elements to gather @return A result tensor

func (*MLCGraph) Layers

func (o *MLCGraph) Layers() *foundation.NSArray[*MLCLayer]

@abstract Layers in the graph

func (*MLCGraph) NodeWithLayerSource

func (o *MLCGraph) NodeWithLayerSource(layer *MLCLayer, source *MLCTensor) *MLCTensor

@abstract Add a layer to the graph @param layer The layer @param source The source tensor @return A result tensor

func (*MLCGraph) NodeWithLayerSources

func (o *MLCGraph) NodeWithLayerSources(layer *MLCLayer, sources *foundation.NSArray[*MLCTensor]) *MLCTensor

@abstract Add a layer to the graph @param layer The layer @param sources A list of source tensors @discussion For variable length sequences of LSTMs/RNNs layers, create an MLCTensor of sortedSequenceLengths and pass it as the last index (i.e. index 2 or 4) of sources. This tensor must of be type MLCDataTypeInt32. @return A result tensor

func (*MLCGraph) NodeWithLayerSourcesDisableUpdate

func (o *MLCGraph) NodeWithLayerSourcesDisableUpdate(layer *MLCLayer, sources *foundation.NSArray[*MLCTensor], disableUpdate bool) *MLCTensor

@abstract Add a layer to the graph @param layer The layer @param sources A list of source tensors @param disableUpdate A flag to indicate if optimizer update should be disabled for this layer @discussion For variable length sequences of LSTMs/RNNs layers, create an MLCTensor of sortedSequenceLengths and pass it as the last index (i.e. index 2 or 4) of sources. This tensor must of be type MLCDataTypeInt32. @return A result tensor

func (*MLCGraph) NodeWithLayerSourcesLossLabels

func (o *MLCGraph) NodeWithLayerSourcesLossLabels(layer *MLCLayer, sources *foundation.NSArray[*MLCTensor], lossLabels *foundation.NSArray[*MLCTensor]) *MLCTensor

@abstract Add a loss layer to the graph @param layer The loss layer @param lossLabels The loss labels tensor @discussion For variable length sequences of LSTMs/RNNs layers, create an MLCTensor of sortedSequenceLengths and pass it as the last index (i.e. index 2 or 4) of sources. This tensor must of be type MLCDataTypeInt32. @return A result tensor

func (*MLCGraph) ReshapeWithShapeSource

func (o *MLCGraph) ReshapeWithShapeSource(shape *foundation.NSArray[*foundation.NSNumber], source *MLCTensor) *MLCTensor

@abstract Add a reshape layer to the graph @param shape An array representing the shape of result tensor @param source The source tensor @return A result tensor

func (*MLCGraph) ResultTensorsForLayer

func (o *MLCGraph) ResultTensorsForLayer(layer *MLCLayer) *foundation.NSArray[*MLCTensor]

@abstract Get the result tensors for a layer in the training graph @param layer A layer in the training graph @return A list of tensors

func (*MLCGraph) ScatterWithDimensionSourceIndicesCopyFromReductionType

func (o *MLCGraph) ScatterWithDimensionSourceIndicesCopyFromReductionType(dimension uint, source *MLCTensor, indices *MLCTensor, copyFrom *MLCTensor, reductionType MLCReductionType) *MLCTensor

@abstract Add a scatter layer to the graph @param dimension The dimension along which to index @param source The updates to use with scattering with index positions specified in indices to result tensor @param indices The index of elements to scatter @param copyFrom The source tensor whose data is to be first copied to the result tensor @param reductionType The reduction type applied for all values in source tensor that are scattered to a specific location in the result tensor. Must be: MLCReductionTypeNone or MLCReductionTypeSum. @return A result tensor

func (*MLCGraph) SelectWithSourcesCondition

func (o *MLCGraph) SelectWithSourcesCondition(sources *foundation.NSArray[*MLCTensor], condition *MLCTensor) *MLCTensor

@abstract Add a select layer to the graph @param sources The source tensors @param condition The condition mask @return A result tensor

func (*MLCGraph) SourceTensorsForLayer

func (o *MLCGraph) SourceTensorsForLayer(layer *MLCLayer) *foundation.NSArray[*MLCTensor]

@abstract Get the source tensors for a layer in the training graph @param layer A layer in the training graph @return A list of tensors

func (*MLCGraph) SplitWithSourceSplitCountDimension

func (o *MLCGraph) SplitWithSourceSplitCountDimension(source *MLCTensor, splitCount uint, dimension uint) *foundation.NSArray[*MLCTensor]

@abstract Add a split layer to the graph @param source The source tensor @param splitCount The number of splits @param dimension The dimension to split the source tensor @return A result tensor

func (*MLCGraph) SplitWithSourceSplitSectionLengthsDimension

func (o *MLCGraph) SplitWithSourceSplitSectionLengthsDimension(source *MLCTensor, splitSectionLengths *foundation.NSArray[*foundation.NSNumber], dimension uint) *foundation.NSArray[*MLCTensor]

@abstract Add a split layer to the graph @param source The source tensor @param splitSectionLengths The lengths of each split section @param dimension The dimension to split the source tensor @return A result tensor

func (*MLCGraph) SummarizedDOTDescription

func (o *MLCGraph) SummarizedDOTDescription() *foundation.NSString

@abstract A DOT representation of the graph. @discussion For more info on the DOT language, refer to https://en.wikipedia.org/wiki/DOT_(graph_description_language). Edges that have a dashed lines are those that have stop gradients, while those with solid lines don't.

func (*MLCGraph) TransposeWithDimensionsSource

func (o *MLCGraph) TransposeWithDimensionsSource(dimensions *foundation.NSArray[*foundation.NSNumber], source *MLCTensor) *MLCTensor

@abstract Add a transpose layer to the graph @param dimensions NSArray<NSNumber *> representing the desired ordering of dimensions The dimensions array specifies the input axis source for each output axis, such that the K'th element in the dimensions array specifies the input axis source for the K'th axis in the output. The batch dimension which is typically axis 0 cannot be transposed. @return A result tensor

type MLCGraphCompilationOptions

type MLCGraphCompilationOptions int64
const (
	// No graph compilation options.
	MLCGraphCompilationOptionsNone MLCGraphCompilationOptions = 0
	// The option to debug layers during graph compilation. @discussion Include this option to disable various optimizations such as layer fusion, and ensure the framework synchronizes the resulting forward and gradients tensors host memory with device memory, for layers marked as debuggable.
	MLCGraphCompilationOptionsDebugLayers MLCGraphCompilationOptions = 1
	// The option to disable layer fusion during graph compilation. @discussion Include this option to disable fusion of layers, which is an important optimization that helps performance and memory footprint.
	MLCGraphCompilationOptionsDisableLayerFusion MLCGraphCompilationOptions = 2
	// The option to link graphs during graph compilation. @discussion Include this option when you link together one or more sub-graphs when executing the forward, gradient, and optimizer update. For example, if the full computation graph includes a layer that the framework doesn’t support, you’ll need to create multiple sub-graphs and link them together using \p MLCGraphCompilationOptionsLinkGraphs. When doing so, include this option when you call \p -compileWithOptions: for graphs you want to link together.
	MLCGraphCompilationOptionsLinkGraphs MLCGraphCompilationOptions = 4
	// The option to compute all gradients during graph compilation. @discussion Include this option to compute gradients for layers with or without parameters that only take input tensors. For example, if the first layer of a graph is a convolution layer, the framework only computes the gradients for weights and biases associated with the convolution layer, but not the gradients for the input. Include this option if you want to compute all gradients for the input.
	MLCGraphCompilationOptionsComputeAllGradients MLCGraphCompilationOptions = 8
)

func (MLCGraphCompilationOptions) String

type MLCGroupNormalizationLayer

type MLCGroupNormalizationLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcgroupnormalizationlayer

func MLCGroupNormalizationLayerFromID

func MLCGroupNormalizationLayerFromID(id objc.ID) *MLCGroupNormalizationLayer

func MLCGroupNormalizationLayerLayerWithFeatureChannelCountGroupCountBetaGammaVarianceEpsilon

func MLCGroupNormalizationLayerLayerWithFeatureChannelCountGroupCountBetaGammaVarianceEpsilon(featureChannelCount uint, groupCount uint, beta *MLCTensor, gamma *MLCTensor, varianceEpsilon float32) *MLCGroupNormalizationLayer

@abstract Create a group normalization layer @param featureChannelCount The number of feature channels @param beta Training parameter @param gamma Training parameter @param groupCount The number of groups to divide the feature channels into @param varianceEpsilon A small numerical value added to variance for stability @return A new group normalization layer.

func (*MLCGroupNormalizationLayer) Beta

@property beta @abstract The beta tensor

func (*MLCGroupNormalizationLayer) BetaParameter

func (o *MLCGroupNormalizationLayer) BetaParameter() *MLCTensorParameter

@property betaParameter @abstract The beta tensor parameter used for optimizer update

func (*MLCGroupNormalizationLayer) FeatureChannelCount

func (o *MLCGroupNormalizationLayer) FeatureChannelCount() uint

@property featureChannelCount @abstract The number of feature channels

func (*MLCGroupNormalizationLayer) Gamma

@property gamma @abstract The gamma tensor

func (*MLCGroupNormalizationLayer) GammaParameter

func (o *MLCGroupNormalizationLayer) GammaParameter() *MLCTensorParameter

@property gammaParameter @abstract The gamma tensor parameter used for optimizer update

func (*MLCGroupNormalizationLayer) GroupCount

func (o *MLCGroupNormalizationLayer) GroupCount() uint

@property groupCount @abstract The number of groups to separate the channels into

func (*MLCGroupNormalizationLayer) VarianceEpsilon

func (o *MLCGroupNormalizationLayer) VarianceEpsilon() float32

@property varianceEpsilon @abstract A value used for numerical stability

type MLCInferenceGraph

type MLCInferenceGraph struct {
	MLCGraph
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcinferencegraph

func MLCInferenceGraphFromID

func MLCInferenceGraphFromID(id objc.ID) *MLCInferenceGraph

func MLCInferenceGraphGraphWithGraphObjects

func MLCInferenceGraphGraphWithGraphObjects(graphObjects *foundation.NSArray[*MLCGraph]) *MLCInferenceGraph

@abstract Create an inference graph @param graphObjects The layers from these graph objects will be added to the training graph @return A new inference graph object

func (*MLCInferenceGraph) AddInputs

@abstract Add the list of inputs to the inference graph @param inputs The inputs @return A boolean indicating success or failure

func (*MLCInferenceGraph) AddInputsLossLabelsLossLabelWeights

func (o *MLCInferenceGraph) AddInputsLossLabelsLossLabelWeights(inputs *foundation.NSDictionary[*foundation.NSString, *MLCTensor], lossLabels *foundation.NSDictionary[*foundation.NSString, *MLCTensor], lossLabelWeights *foundation.NSDictionary[*foundation.NSString, *MLCTensor]) bool

@abstract Add the list of inputs to the inference graph @discussion Each input, loss label or label weights tensor is identified by a NSString. When the inference graph is executed, this NSString is used to identify which data object should be as input data for each tensor whose device memory needs to be updated before the graph is executed. @param inputs The inputs @param lossLabels The loss label inputs @param lossLabelWeights The loss label weights @return A boolean indicating success or failure

func (*MLCInferenceGraph) AddOutputs

@abstract Add the list of outputs to the inference graph @param outputs The outputs @return A boolean indicating success or failure

func (*MLCInferenceGraph) CompileWithOptionsDevice

func (o *MLCInferenceGraph) CompileWithOptionsDevice(options MLCGraphCompilationOptions, device *MLCDevice) bool

@abstract Compile the training graph for a device. @param options The compiler options to use when compiling the training graph @param device The MLCDevice object @return A boolean indicating success or failure

func (*MLCInferenceGraph) CompileWithOptionsDeviceInputTensorsInputTensorsData

func (o *MLCInferenceGraph) CompileWithOptionsDeviceInputTensorsInputTensorsData(options MLCGraphCompilationOptions, device *MLCDevice, inputTensors *foundation.NSDictionary[*foundation.NSString, *MLCTensor], inputTensorsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData]) bool

@abstract Compile the inference graph for a device. @discussion Specifying the list of constant tensors when we compile the graph allows MLCompute to perform additional optimizations at compile time. @param options The compiler options to use when compiling the inference graph @param device The MLCDevice object @param inputTensors The list of input tensors that are constants @param inputTensorsData The tensor data to be used with these constant input tensors @return A boolean indicating success or failure

func (*MLCInferenceGraph) DeviceMemorySize

func (o *MLCInferenceGraph) DeviceMemorySize() uint

@property The device memory size used by the inference graph @abstract Returns the total size in bytes of device memory used by all intermediate tensors in the inference graph @return A NSUInteger value

func (*MLCInferenceGraph) ExecuteWithInputsDataBatchSizeOptionsCompletionHandler

func (o *MLCInferenceGraph) ExecuteWithInputsDataBatchSizeOptionsCompletionHandler(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the inference graph with given input data @discussion Execute the inference graph given input data. If MLCExecutionOptionsSynchronous is specified in 'options', this method returns after the graph has been executed. Otherwise, this method returns after the graph has been queued for execution. The completion handler is called after the graph has finished execution. @param inputsData The data objects to use for inputs @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCInferenceGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataBatchSizeOptionsCompletionHandler

func (o *MLCInferenceGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataBatchSizeOptionsCompletionHandler(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelWeightsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the inference graph with given input data @discussion Execute the inference graph given input data. If MLCExecutionOptionsSynchronous is specified in 'options', this method returns after the graph has been executed. Otherwise, this method returns after the graph has been queued for execution. The completion handler is called after the graph has finished execution. @param inputsData The data objects to use for inputs @param lossLabelsData The data objects to use for loss labels @param lossLabelWeightsData The data objects to use for loss label weights @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCInferenceGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataOutputsDataBatchSizeOptionsCompletionHandler

func (o *MLCInferenceGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataOutputsDataBatchSizeOptionsCompletionHandler(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelWeightsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], outputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the inference graph with given input data @discussion Execute the inference graph given input data. If MLCExecutionOptionsSynchronous is specified in 'options', this method returns after the graph has been executed. Otherwise, this method returns after the graph has been queued for execution. The completion handler is called after the graph has finished execution. @param inputsData The data objects to use for inputs @param lossLabelsData The data objects to use for loss labels @param lossLabelWeightsData The data objects to use for loss label weights @param outputsData The data objects to use for outputs @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCInferenceGraph) ExecuteWithInputsDataOutputsDataBatchSizeOptionsCompletionHandler

func (o *MLCInferenceGraph) ExecuteWithInputsDataOutputsDataBatchSizeOptionsCompletionHandler(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], outputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the inference graph with given input data @discussion Execute the inference graph given input data. If MLCExecutionOptionsSynchronous is specified in 'options', this method returns after the graph has been executed. Otherwise, this method returns after the graph has been queued for execution. The completion handler is called after the graph has finished execution. @param inputsData The data objects to use for inputs @param outputsData The data objects to use for outputs @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCInferenceGraph) LinkWithGraphs

func (o *MLCInferenceGraph) LinkWithGraphs(graphs *foundation.NSArray[*MLCInferenceGraph]) bool

@abstract Link mutiple inference graphs @discussion This is used to link subsequent inference graphs with first inference sub-graph. This method should be used when we have tensors shared by one or more layers in multiple sub-graphs @param graphs The list of inference graphs to link @return A boolean indicating success or failure

type MLCInstanceNormalizationLayer

type MLCInstanceNormalizationLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcinstancenormalizationlayer

func MLCInstanceNormalizationLayerFromID

func MLCInstanceNormalizationLayerFromID(id objc.ID) *MLCInstanceNormalizationLayer

func MLCInstanceNormalizationLayerLayerWithFeatureChannelCountBetaGammaVarianceEpsilon

func MLCInstanceNormalizationLayerLayerWithFeatureChannelCountBetaGammaVarianceEpsilon(featureChannelCount uint, beta *MLCTensor, gamma *MLCTensor, varianceEpsilon float32) *MLCInstanceNormalizationLayer

@abstract Create an instance normalization layer @param featureChannelCount The number of feature channels @param beta The beta tensor @param gamma The gamma tensor @param varianceEpsilon The epslion value @return A new instance normalization layer.

func MLCInstanceNormalizationLayerLayerWithFeatureChannelCountBetaGammaVarianceEpsilonMomentum

func MLCInstanceNormalizationLayerLayerWithFeatureChannelCountBetaGammaVarianceEpsilonMomentum(featureChannelCount uint, beta *MLCTensor, gamma *MLCTensor, varianceEpsilon float32, momentum float32) *MLCInstanceNormalizationLayer

@abstract Create an instance normalization layer @param featureChannelCount The number of feature channels @param beta The beta tensor @param gamma The gamma tensor @param varianceEpsilon The epslion value @param momentum The momentum value for the running mean and variance computation @return A new instance normalization layer.

func MLCInstanceNormalizationLayerLayerWithFeatureChannelCountMeanVarianceBetaGammaVarianceEpsilonMomentum

func MLCInstanceNormalizationLayerLayerWithFeatureChannelCountMeanVarianceBetaGammaVarianceEpsilonMomentum(featureChannelCount uint, mean *MLCTensor, variance *MLCTensor, beta *MLCTensor, gamma *MLCTensor, varianceEpsilon float32, momentum float32) *MLCInstanceNormalizationLayer

@abstract Create an instance normalization layer @param featureChannelCount The number of feature channels @param mean The running mean tensor @param variance The running variance tensor @param beta The beta tensor @param gamma The gamma tensor @param varianceEpsilon The epslion value @param momentum The momentum value for the running mean and variance computation @return A new instance normalization layer.

func (*MLCInstanceNormalizationLayer) Beta

@property beta @abstract The beta tensor

func (*MLCInstanceNormalizationLayer) BetaParameter

@property betaParameter @abstract The beta tensor parameter used for optimizer update

func (*MLCInstanceNormalizationLayer) FeatureChannelCount

func (o *MLCInstanceNormalizationLayer) FeatureChannelCount() uint

@property featureChannelCount @abstract The number of feature channels

func (*MLCInstanceNormalizationLayer) Gamma

@property gamma @abstract The gamma tensor

func (*MLCInstanceNormalizationLayer) GammaParameter

@property gammaParameter @abstract The gamma tensor parameter used for optimizer update

func (*MLCInstanceNormalizationLayer) Mean

@property mean @abstract The running mean tensor

func (*MLCInstanceNormalizationLayer) Momentum

func (o *MLCInstanceNormalizationLayer) Momentum() float32

@property momentum @abstract The value used for the running mean and variance computation @discussion The default is 0.99f.

func (*MLCInstanceNormalizationLayer) Variance

@property variance @abstract The running variance tensor

func (*MLCInstanceNormalizationLayer) VarianceEpsilon

func (o *MLCInstanceNormalizationLayer) VarianceEpsilon() float32

@property varianceEpsilon @abstract A value used for numerical stability

type MLCLSTMDescriptor

type MLCLSTMDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlclstmdescriptor

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCount

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCount(inputSize uint, hiddenSize uint, layerCount uint) *MLCLSTMDescriptor

@abstract Creates a LSTM descriptor with batchFirst = YES @param inputSize The number of expected features in the input @param hiddenSize The number of features in the hidden state @param layerCount Number of recurrent layers @return A valid MLCLSTMDescriptor object or nil, if failure.

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesBatchFirstIsBidirectionalDropout

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesBatchFirstIsBidirectionalDropout(inputSize uint, hiddenSize uint, layerCount uint, usesBiases bool, batchFirst bool, isBidirectional bool, dropout float32) *MLCLSTMDescriptor

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesBatchFirstIsBidirectionalReturnsSequencesDropout

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesBatchFirstIsBidirectionalReturnsSequencesDropout(inputSize uint, hiddenSize uint, layerCount uint, usesBiases bool, batchFirst bool, isBidirectional bool, returnsSequences bool, dropout float32) *MLCLSTMDescriptor

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesBatchFirstIsBidirectionalReturnsSequencesDropoutResultMode

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesBatchFirstIsBidirectionalReturnsSequencesDropoutResultMode(inputSize uint, hiddenSize uint, layerCount uint, usesBiases bool, batchFirst bool, isBidirectional bool, returnsSequences bool, dropout float32, resultMode MLCLSTMResultMode) *MLCLSTMDescriptor

@abstract Creates a LSTM descriptor. @param inputSize The number of expected features in the input @param hiddenSize The number of features in the hidden state @param layerCount Number of recurrent layers @param usesBiases If NO, the layer does not use bias weights. Default: YES @param batchFirst LSTM only supports batchFirst=YES. This means the input and output will have shape [batch size, time steps, feature]. Default is YES. @param isBidirectional If YES, becomes a bi-directional LSTM. Default: NO @param returnsSequences if YES return output for all sequences else return output only for the last sequences. Default: YES @param dropout If non-zero, introduces a dropout layer on the outputs of each LSTM layer except the last layer with dropout probability equal to dropout. @param resultMode expected result tensors. MLCLSTMResultModeOutput returns output data. MLCLSTMResultModeOutputAndStates returns output data, last hidden state h_n, and last cell state c_n. Default: MLCLSTMResultModeOutput. @return A valid MLCLSTMDescriptor object or nil, if failure.

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesIsBidirectionalDropout

func MLCLSTMDescriptorDescriptorWithInputSizeHiddenSizeLayerCountUsesBiasesIsBidirectionalDropout(inputSize uint, hiddenSize uint, layerCount uint, usesBiases bool, isBidirectional bool, dropout float32) *MLCLSTMDescriptor

@abstract Creates a LSTM descriptor descriptor with batchFirst = YES @param inputSize The number of expected features in the input @param hiddenSize The number of features in the hidden state @param layerCount Number of recurrent layers @param usesBiases If NO, the layer does not use bias weights. Default: YES @param isBidirectional If YES, becomes a bi-directional LSTM. Default: NO @param dropout If non-zero, introduces a dropout layer on the outputs of each LSTM layer except the last layer with dropout probability equal to dropout. @return A valid MLCLSTMDescriptor object or nil, if failure.

func MLCLSTMDescriptorFromID

func MLCLSTMDescriptorFromID(id objc.ID) *MLCLSTMDescriptor

func (*MLCLSTMDescriptor) BatchFirst

func (o *MLCLSTMDescriptor) BatchFirst() bool

@property batchFirst @abstract LSTM only supports batchFirst=YES. This means the input and output will have shape [batch size, time steps, feature]. Default is YES.

func (*MLCLSTMDescriptor) Dropout

func (o *MLCLSTMDescriptor) Dropout() float32

@property dropout @abstract If non-zero, intrdouces a dropout layer on the outputs of each LSTM layer except the last layer, with dropout probablity equal to dropout. Default is 0.0.

func (*MLCLSTMDescriptor) HiddenSize

func (o *MLCLSTMDescriptor) HiddenSize() uint

@property hiddenSize @abstract The number of feature channels in the hidden state

func (*MLCLSTMDescriptor) InputSize

func (o *MLCLSTMDescriptor) InputSize() uint

@property inputSize @abstract The number of expected feature channels in the input

func (*MLCLSTMDescriptor) IsBidirectional

func (o *MLCLSTMDescriptor) IsBidirectional() bool

@property isBidirectional @abstract If YES, becomes a bidirectional LSTM. Default is NO.

func (*MLCLSTMDescriptor) LayerCount

func (o *MLCLSTMDescriptor) LayerCount() uint

@property layerCount @abstract The number of recurrent layers. Default is 1.

func (*MLCLSTMDescriptor) ResultMode

func (o *MLCLSTMDescriptor) ResultMode() MLCLSTMResultMode

@property resultMode @abstract MLCLSTMResultModeOutput returns output data. MLCLSTMResultModeOutputAndStates returns output data, last hidden state h_n, and last cell state c_n. Default MLCLSTMResultModeOutput.

func (*MLCLSTMDescriptor) ReturnsSequences

func (o *MLCLSTMDescriptor) ReturnsSequences() bool

@property returnsSequences @abstract if YES return output for all sequences else return output only for the last sequences. Default: YES

func (*MLCLSTMDescriptor) UsesBiases

func (o *MLCLSTMDescriptor) UsesBiases() bool

@property usesBiases @abstract If NO, the layer does not use bias terms. Default is YES.

type MLCLSTMLayer

type MLCLSTMLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlclstmlayer

func MLCLSTMLayerFromID

func MLCLSTMLayerFromID(id objc.ID) *MLCLSTMLayer

func MLCLSTMLayerLayerWithDescriptorInputWeightsHiddenWeightsBiases

func MLCLSTMLayerLayerWithDescriptorInputWeightsHiddenWeightsBiases(descriptor *MLCLSTMDescriptor, inputWeights *foundation.NSArray[*MLCTensor], hiddenWeights *foundation.NSArray[*MLCTensor], biases *foundation.NSArray[*MLCTensor]) *MLCLSTMLayer

@abstract Create a LSTM layer @param descriptor The LSTM descriptor @param inputWeights An array of (layerCount * 4) tensors describing the input weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. @param hiddenWeights An array of (layerCount * 4) tensors describing the hidden weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. @return A new LSTM layer.

func MLCLSTMLayerLayerWithDescriptorInputWeightsHiddenWeightsPeepholeWeightsBiases

func MLCLSTMLayerLayerWithDescriptorInputWeightsHiddenWeightsPeepholeWeightsBiases(descriptor *MLCLSTMDescriptor, inputWeights *foundation.NSArray[*MLCTensor], hiddenWeights *foundation.NSArray[*MLCTensor], peepholeWeights *foundation.NSArray[*MLCTensor], biases *foundation.NSArray[*MLCTensor]) *MLCLSTMLayer

@abstract Create a LSTM layer @param descriptor The LSTM descriptor @param inputWeights An array of (layerCount * 4) tensors describing the input weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. @param hiddenWeights An array of (layerCount * 4) tensors describing the hidden weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. @param peepholeWeights An array of (layerCount * 4) tensors describing the peephole weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. @return A new LSTM layer.

func MLCLSTMLayerLayerWithDescriptorInputWeightsHiddenWeightsPeepholeWeightsBiasesGateActivationsOutputResultActivation

func MLCLSTMLayerLayerWithDescriptorInputWeightsHiddenWeightsPeepholeWeightsBiasesGateActivationsOutputResultActivation(descriptor *MLCLSTMDescriptor, inputWeights *foundation.NSArray[*MLCTensor], hiddenWeights *foundation.NSArray[*MLCTensor], peepholeWeights *foundation.NSArray[*MLCTensor], biases *foundation.NSArray[*MLCTensor], gateActivations *foundation.NSArray[*MLCActivationDescriptor], outputResultActivation *MLCActivationDescriptor) *MLCLSTMLayer

@abstract Create a LSTM layer @param descriptor The LSTM descriptor @param inputWeights An array of (layerCount * 4) tensors describing the input weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. For bidirectional LSTM, the forward time weights for all stacked layers will come first followed by backward time weights @param hiddenWeights An array of (layerCount * 4) tensors describing the hidden weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. For bidirectional LSTM, the forward time weights for all stacked layers will come first followed by backward time weights @param peepholeWeights An array of (layerCount * 4) tensors describing the peephole weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. @param biases An array of (layerCount * 4) tensors describing the input weights for the input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n. For bidirectional LSTM, the forward time bias terms for all stacked layers will come first followed by backward time bias terms @param gateActivations An array of 4 neuron descriptors for the input, hidden, cell and output gate activations. @param outputResultActivation The neuron descriptor used for the activation function applied to output result. Default is tanh. @return A new LSTM layer.

func (*MLCLSTMLayer) Biases

func (o *MLCLSTMLayer) Biases() *foundation.NSArray[*MLCTensor]

@property biases @abstract The array of tensors describing the bias terms for the input, hidden, cell and output gates

func (*MLCLSTMLayer) BiasesParameters

func (o *MLCLSTMLayer) BiasesParameters() *foundation.NSArray[*MLCTensorParameter]

@property biasesParameters @abstract The bias tensor parameter used for optimizer update

func (*MLCLSTMLayer) Descriptor

func (o *MLCLSTMLayer) Descriptor() *MLCLSTMDescriptor

@property descriptor @abstract The LSTM descriptor

func (*MLCLSTMLayer) GateActivations

func (o *MLCLSTMLayer) GateActivations() *foundation.NSArray[*MLCActivationDescriptor]

@property gateActivations @abstract The array of gate activations for input, hidden, cell and output gates @discussion The default gate activations are: sigmoid, sigmoid, tanh, sigmoid

func (*MLCLSTMLayer) HiddenWeights

func (o *MLCLSTMLayer) HiddenWeights() *foundation.NSArray[*MLCTensor]

@property hiddenWeights @abstract The array of tensors describing the hidden weights for the input, hidden, cell and output gates

func (*MLCLSTMLayer) HiddenWeightsParameters

func (o *MLCLSTMLayer) HiddenWeightsParameters() *foundation.NSArray[*MLCTensorParameter]

@property hiddenWeightsParameters @abstract The hidden weights tensor parameters used for optimizer update

func (*MLCLSTMLayer) InputWeights

func (o *MLCLSTMLayer) InputWeights() *foundation.NSArray[*MLCTensor]

@property inputWeights @abstract The array of tensors describing the input weights for the input, hidden, cell and output gates

func (*MLCLSTMLayer) InputWeightsParameters

func (o *MLCLSTMLayer) InputWeightsParameters() *foundation.NSArray[*MLCTensorParameter]

@property inputWeightsParameters @abstract The input weights tensor parameters used for optimizer update

func (*MLCLSTMLayer) OutputResultActivation

func (o *MLCLSTMLayer) OutputResultActivation() *MLCActivationDescriptor

@property outputResultActivation @abstract The output activation descriptor

func (*MLCLSTMLayer) PeepholeWeights

func (o *MLCLSTMLayer) PeepholeWeights() *foundation.NSArray[*MLCTensor]

@property peepholeWeights @abstract The array of tensors describing the peephole weights for the input, hidden, cell and output gates

func (*MLCLSTMLayer) PeepholeWeightsParameters

func (o *MLCLSTMLayer) PeepholeWeightsParameters() *foundation.NSArray[*MLCTensorParameter]

@property peepholeWeightsParameters @abstract The peephole weights tensor parameters used for optimizer update

type MLCLSTMResultMode

type MLCLSTMResultMode int64
const (
	// The output result mode. When selected for an LSTM layer, the layer will produce a single result tensor representing the final output of the LSTM.
	MLCLSTMResultModeOutput MLCLSTMResultMode = 0
	// The output and states result mode. When selected for an LSTM layer, the layer will produce three result tensors representing the final output of the LSTM, the last hidden state, and the cell state, respectively.
	MLCLSTMResultModeOutputAndStates MLCLSTMResultMode = 1
)

func (MLCLSTMResultMode) String

func (e MLCLSTMResultMode) String() string

type MLCLayer

type MLCLayer struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlclayer

func MLCLayerFromID

func MLCLayerFromID(id objc.ID) *MLCLayer

func (*MLCLayer) DeviceType

func (o *MLCLayer) DeviceType() MLCDeviceType

@property deviceType @abstract The device type where this layer will be executed @discussion Typically the MLCDevice passed to compileWithOptions will be the device used to execute layers in the graph. If MLCDeviceTypeANE is selected, it is possible that some of the layers of the graph may not be executed on the ANE but instead on the CPU or GPU. This property can be used to determine which device type the layer will be executed on.

func (*MLCLayer) IsDebuggingEnabled

func (o *MLCLayer) IsDebuggingEnabled() bool

@property isDebuggingEnabled @abstract A flag to identify if we want to debug this layer when executing a graph that includes this layer @discussion If this is set, we will make sure that the result tensor and gradient tensors are available for reading on CPU The default is NO. If isDebuggingEnabled is set to YES, make sure to set options to enable debugging when compiling the graph. Otherwise this property may be ignored.

func (*MLCLayer) Label

func (o *MLCLayer) Label() *foundation.NSString

@property label @abstract A string to help identify this object.

func (*MLCLayer) LayerID

func (o *MLCLayer) LayerID() uint

@property layerID @abstract The layer ID @discussion A unique number to identify each layer. Assigned when the layer is created.

func (*MLCLayer) SetIsDebuggingEnabled

func (o *MLCLayer) SetIsDebuggingEnabled(isDebuggingEnabled bool)

func (*MLCLayer) SetLabel

func (o *MLCLayer) SetLabel(label *foundation.NSString)

type MLCLayerNormalizationLayer

type MLCLayerNormalizationLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlclayernormalizationlayer

func MLCLayerNormalizationLayerFromID

func MLCLayerNormalizationLayerFromID(id objc.ID) *MLCLayerNormalizationLayer

func MLCLayerNormalizationLayerLayerWithNormalizedShapeBetaGammaVarianceEpsilon

func MLCLayerNormalizationLayerLayerWithNormalizedShapeBetaGammaVarianceEpsilon(normalizedShape *foundation.NSArray[*foundation.NSNumber], beta *MLCTensor, gamma *MLCTensor, varianceEpsilon float32) *MLCLayerNormalizationLayer

@abstract Create a layer normalization layer @param normalizedShape The shape of the axes over which normalization occurs, currently (C,H,W) only @param beta Training parameter @param gamma Training parameter @param varianceEpsilon A small numerical value added to variance for stability @return A new layer normalization layer.

func (*MLCLayerNormalizationLayer) Beta

@property beta @abstract The beta tensor

func (*MLCLayerNormalizationLayer) BetaParameter

func (o *MLCLayerNormalizationLayer) BetaParameter() *MLCTensorParameter

@property betaParameter @abstract The beta tensor parameter used for optimizer update

func (*MLCLayerNormalizationLayer) Gamma

@property gamma @abstract The gamma tensor

func (*MLCLayerNormalizationLayer) GammaParameter

func (o *MLCLayerNormalizationLayer) GammaParameter() *MLCTensorParameter

@property gammaParameter @abstract The gamma tensor parameter used for optimizer update

func (*MLCLayerNormalizationLayer) NormalizedShape

@property normalizedShape @abstract The shape of the axes over which normalization occurs, (W), (H,W) or (C,H,W)

func (*MLCLayerNormalizationLayer) VarianceEpsilon

func (o *MLCLayerNormalizationLayer) VarianceEpsilon() float32

@property varianceEpsilon @abstract A value used for numerical stability

type MLCLossDescriptor

type MLCLossDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlclossdescriptor

func MLCLossDescriptorDescriptorWithTypeReductionType

func MLCLossDescriptorDescriptorWithTypeReductionType(lossType MLCLossType, reductionType MLCReductionType) *MLCLossDescriptor

@abstract Create a loss descriptor object @param lossType The loss function. @param reductionType The reduction operation @return A new MLCLossDescriptor object

func MLCLossDescriptorDescriptorWithTypeReductionTypeWeight

func MLCLossDescriptorDescriptorWithTypeReductionTypeWeight(lossType MLCLossType, reductionType MLCReductionType, weight float32) *MLCLossDescriptor

@abstract Create a loss descriptor object @param lossType The loss function. @param reductionType The reduction operation @param weight The scale factor to apply to each element of a result. @return A new MLCLossDescriptor object

func MLCLossDescriptorDescriptorWithTypeReductionTypeWeightLabelSmoothingClassCount

func MLCLossDescriptorDescriptorWithTypeReductionTypeWeightLabelSmoothingClassCount(lossType MLCLossType, reductionType MLCReductionType, weight float32, labelSmoothing float32, classCount uint) *MLCLossDescriptor

@abstract Create a loss descriptor object @param lossType The loss function. @param reductionType The reduction operation @param weight The scale factor to apply to each element of a result. @param labelSmoothing The label smoothing parameter. @param classCount The number of classes parameter. @return A new MLCLossDescriptor object

func MLCLossDescriptorDescriptorWithTypeReductionTypeWeightLabelSmoothingClassCountEpsilonDelta

func MLCLossDescriptorDescriptorWithTypeReductionTypeWeightLabelSmoothingClassCountEpsilonDelta(lossType MLCLossType, reductionType MLCReductionType, weight float32, labelSmoothing float32, classCount uint, epsilon float32, delta float32) *MLCLossDescriptor

@abstract Create a loss descriptor object @param lossType The loss function. @param reductionType The reduction operation @param weight The scale factor to apply to each element of a result. @param labelSmoothing The label smoothing parameter. @param classCount The number of classes parameter. @param epsilon The epsilon used by LogLoss @param delta The delta parameter used by Huber loss @return A new MLCLossDescriptor object

func MLCLossDescriptorFromID

func MLCLossDescriptorFromID(id objc.ID) *MLCLossDescriptor

func (*MLCLossDescriptor) ClassCount

func (o *MLCLossDescriptor) ClassCount() uint

@property numberOfClasses @abstract The number of classes parameter. The default value is 1. @discussion This parameter is valid only for the loss function MLCLossTypeSoftmaxCrossEntropy.

func (*MLCLossDescriptor) Delta

func (o *MLCLossDescriptor) Delta() float32

@property delta @abstract The delta parameter. The default value is 1.0f. @discussion This parameter is valid only for the loss function MLCLossTypeHuber.

func (*MLCLossDescriptor) Epsilon

func (o *MLCLossDescriptor) Epsilon() float32

@property epsilon @abstract The epsilon parameter. The default value is 1e-7. @discussion This parameter is valid only for the loss function MLCLossTypeLog.

func (*MLCLossDescriptor) LabelSmoothing

func (o *MLCLossDescriptor) LabelSmoothing() float32

@property labelSmoothing @abstract The label smoothing parameter. The default value is 0.0. @discussion This parameter is valid only for the loss functions of the following type(s): MLCLossTypeSoftmaxCrossEntropy and MLCLossTypeSigmoidCrossEntropy.

func (*MLCLossDescriptor) LossType

func (o *MLCLossDescriptor) LossType() MLCLossType

@property lossType @abstract Specifies the loss function.

func (*MLCLossDescriptor) ReductionType

func (o *MLCLossDescriptor) ReductionType() MLCReductionType

@property reductionType @abstract The reduction operation performed by the loss function.

func (*MLCLossDescriptor) Weight

func (o *MLCLossDescriptor) Weight() float32

@property weight @abstract The scale factor to apply to each element of a result. The default value is 1.0.

type MLCLossLayer

type MLCLossLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlclosslayer

func MLCLossLayerCategoricalCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeight

func MLCLossLayerCategoricalCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeight(reductionType MLCReductionType, labelSmoothing float32, classCount uint, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param labelSmoothing Label smoothing value @param classCount Number of classes @param weight A scalar floating point value @return A new categorical cross entropy loss layer.

func MLCLossLayerCategoricalCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeights

func MLCLossLayerCategoricalCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeights(reductionType MLCReductionType, labelSmoothing float32, classCount uint, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param labelSmoothing Label smoothing value @param classCount Number of classes @param weights The loss label weights tensor @return A new categorical cross entropy loss layer.

func MLCLossLayerCosineDistanceLossWithReductionTypeWeight

func MLCLossLayerCosineDistanceLossWithReductionTypeWeight(reductionType MLCReductionType, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weight A scalar floating-point value @return A new cosine distance loss layer.

func MLCLossLayerCosineDistanceLossWithReductionTypeWeights

func MLCLossLayerCosineDistanceLossWithReductionTypeWeights(reductionType MLCReductionType, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weights The loss label weights tensor @return A new cosine distance loss layer.

func MLCLossLayerFromID

func MLCLossLayerFromID(id objc.ID) *MLCLossLayer

func MLCLossLayerHingeLossWithReductionTypeWeight

func MLCLossLayerHingeLossWithReductionTypeWeight(reductionType MLCReductionType, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weight A scalar floating-point value @return A new hinge loss layer.

func MLCLossLayerHingeLossWithReductionTypeWeights

func MLCLossLayerHingeLossWithReductionTypeWeights(reductionType MLCReductionType, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weights The loss label weights tensor @return A new hinge loss layer.

func MLCLossLayerHuberLossWithReductionTypeDeltaWeight

func MLCLossLayerHuberLossWithReductionTypeDeltaWeight(reductionType MLCReductionType, delta float32, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param delta The delta parameter @param weight A scalar floating-point value @return A new huber loss layer.

func MLCLossLayerHuberLossWithReductionTypeDeltaWeights

func MLCLossLayerHuberLossWithReductionTypeDeltaWeights(reductionType MLCReductionType, delta float32, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param delta The delta parameter @param weights The loss label weights tensor @return A new huber loss layer.

func MLCLossLayerLayerWithDescriptor

func MLCLossLayerLayerWithDescriptor(lossDescriptor *MLCLossDescriptor) *MLCLossLayer

@abstract Create a loss layer @param lossDescriptor The loss descriptor @return A new loss layer.

func MLCLossLayerLayerWithDescriptorWeights

func MLCLossLayerLayerWithDescriptorWeights(lossDescriptor *MLCLossDescriptor, weights *MLCTensor) *MLCLossLayer

@abstract Create a MLComputeLoss layer @param lossDescriptor The loss descriptor @param weights The loss label weights tensor @return A new loss layer.

func MLCLossLayerLogLossWithReductionTypeEpsilonWeight

func MLCLossLayerLogLossWithReductionTypeEpsilonWeight(reductionType MLCReductionType, epsilon float32, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param epsilon The epsilon parameter @param weight A scalar floating-point value @return A new log loss layer.

func MLCLossLayerLogLossWithReductionTypeEpsilonWeights

func MLCLossLayerLogLossWithReductionTypeEpsilonWeights(reductionType MLCReductionType, epsilon float32, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param epsilon The epsilon parameter @param weights The loss label weights tensor @return A new log loss layer.

func MLCLossLayerMeanAbsoluteErrorLossWithReductionTypeWeight

func MLCLossLayerMeanAbsoluteErrorLossWithReductionTypeWeight(reductionType MLCReductionType, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weight A scalar floating-point value @return A new L1 i.e. mean absolute error loss layer.

func MLCLossLayerMeanAbsoluteErrorLossWithReductionTypeWeights

func MLCLossLayerMeanAbsoluteErrorLossWithReductionTypeWeights(reductionType MLCReductionType, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weights The loss label weights tensor @return A new L1 i.e. mean absolute error loss layer.

func MLCLossLayerMeanSquaredErrorLossWithReductionTypeWeight

func MLCLossLayerMeanSquaredErrorLossWithReductionTypeWeight(reductionType MLCReductionType, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weight A scalar floating-point value @return A new L2 i.e. mean squared error loss layer.

func MLCLossLayerMeanSquaredErrorLossWithReductionTypeWeights

func MLCLossLayerMeanSquaredErrorLossWithReductionTypeWeights(reductionType MLCReductionType, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param weights The loss label weights tensor @return A new L2 i.e. mean squared error loss layer.

func MLCLossLayerSigmoidCrossEntropyLossWithReductionTypeLabelSmoothingWeight

func MLCLossLayerSigmoidCrossEntropyLossWithReductionTypeLabelSmoothingWeight(reductionType MLCReductionType, labelSmoothing float32, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param labelSmoothing Label smoothing value @param weight A scalar floating-point value @return A new sigmoid cross entropy loss layer.

func MLCLossLayerSigmoidCrossEntropyLossWithReductionTypeLabelSmoothingWeights

func MLCLossLayerSigmoidCrossEntropyLossWithReductionTypeLabelSmoothingWeights(reductionType MLCReductionType, labelSmoothing float32, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param labelSmoothing Label smoothing value @param weights The loss label weights tensor @return A new sigmoid cross entropy loss layer.

func MLCLossLayerSoftmaxCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeight

func MLCLossLayerSoftmaxCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeight(reductionType MLCReductionType, labelSmoothing float32, classCount uint, weight float32) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param labelSmoothing Label smoothing value @param classCount Number of classes @param weight A scalar floating point value @return A new softmax cross entropy loss layer.

func MLCLossLayerSoftmaxCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeights

func MLCLossLayerSoftmaxCrossEntropyLossWithReductionTypeLabelSmoothingClassCountWeights(reductionType MLCReductionType, labelSmoothing float32, classCount uint, weights *MLCTensor) *MLCLossLayer

@abstract Create a loss layer @param reductionType The reduction type to use @param labelSmoothing Label smoothing value @param classCount Number of classes @param weights The loss label weights tensor @return A new softmax cross entropy loss layer.

func (*MLCLossLayer) Descriptor

func (o *MLCLossLayer) Descriptor() *MLCLossDescriptor

@property descriptor @abstract The loss descriptor

func (*MLCLossLayer) Weights

func (o *MLCLossLayer) Weights() *MLCTensor

@property weights @abstract The loss label weights tensor

type MLCLossType

type MLCLossType int64
const (
	// The mean absolute error loss.
	MLCLossTypeMeanAbsoluteError MLCLossType = 0
	// The mean squared error loss.
	MLCLossTypeMeanSquaredError MLCLossType = 1
	// The softmax cross entropy loss.
	MLCLossTypeSoftmaxCrossEntropy MLCLossType = 2
	// The sigmoid cross entropy loss.
	MLCLossTypeSigmoidCrossEntropy MLCLossType = 3
	// The categorical cross entropy loss.
	MLCLossTypeCategoricalCrossEntropy MLCLossType = 4
	// The hinge loss.
	MLCLossTypeHinge MLCLossType = 5
	// The Huber loss.
	MLCLossTypeHuber MLCLossType = 6
	// The cosine distance loss.
	MLCLossTypeCosineDistance MLCLossType = 7
	// The log loss.
	MLCLossTypeLog   MLCLossType = 8
	MLCLossTypeCount MLCLossType = 9
)

func (MLCLossType) String

func (e MLCLossType) String() string

type MLCMatMulDescriptor

type MLCMatMulDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcmatmuldescriptor

func MLCMatMulDescriptorDescriptor

func MLCMatMulDescriptorDescriptor() *MLCMatMulDescriptor

@property descriptor @abstract A matrix multiplication layer descriptor

func MLCMatMulDescriptorDescriptorWithAlphaTransposesXTransposesY

func MLCMatMulDescriptorDescriptorWithAlphaTransposesXTransposesY(alpha float32, transposesX bool, transposesY bool) *MLCMatMulDescriptor

@abstract A matrix multiplication layer descriptor @param alpha a scalar to scale the left hand side, C = alpha x X x Y @param transposesX if true, transposes the last two dimensions of X @param transposesY if true, transposes the last two dimensions of Y @return A new matrix multiplication layer descriptor

func MLCMatMulDescriptorFromID

func MLCMatMulDescriptorFromID(id objc.ID) *MLCMatMulDescriptor

func (*MLCMatMulDescriptor) Alpha

func (o *MLCMatMulDescriptor) Alpha() float32

@brief a scalar to scale the result in C=alpha x X x Y. Default = 1.0

func (*MLCMatMulDescriptor) TransposesX

func (o *MLCMatMulDescriptor) TransposesX() bool

@brief if true, transposes the last two dimensions of X. Default = False

func (*MLCMatMulDescriptor) TransposesY

func (o *MLCMatMulDescriptor) TransposesY() bool

@brief if true, transposes the last two dimensions of Y. Default = False

type MLCMatMulLayer

type MLCMatMulLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcmatmullayer

func MLCMatMulLayerFromID

func MLCMatMulLayerFromID(id objc.ID) *MLCMatMulLayer

func MLCMatMulLayerLayerWithDescriptor

func MLCMatMulLayerLayerWithDescriptor(descriptor *MLCMatMulDescriptor) *MLCMatMulLayer

@abstract Create a matrix multiply layer @param descriptor A matrix multiply descriptor @return A new layer for matrix multiplication.

func (*MLCMatMulLayer) Descriptor

func (o *MLCMatMulLayer) Descriptor() *MLCMatMulDescriptor

@property descriptor @abstract The matrix multiplication descriptor

type MLCMultiheadAttentionDescriptor

type MLCMultiheadAttentionDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcmultiheadattentiondescriptor

func MLCMultiheadAttentionDescriptorDescriptorWithModelDimensionHeadCount

func MLCMultiheadAttentionDescriptorDescriptorWithModelDimensionHeadCount(modelDimension uint, headCount uint) *MLCMultiheadAttentionDescriptor

@abstract A multi-head attention layer descriptor @param modelDimension total dimension of model space @param headCount number of parallel attention heads @return A valid MultiheadAttention layer descriptor

func MLCMultiheadAttentionDescriptorDescriptorWithModelDimensionKeyDimensionValueDimensionHeadCountDropoutHasBiasesHasAttentionBiasesAddsZeroAttention

func MLCMultiheadAttentionDescriptorDescriptorWithModelDimensionKeyDimensionValueDimensionHeadCountDropoutHasBiasesHasAttentionBiasesAddsZeroAttention(modelDimension uint, keyDimension uint, valueDimension uint, headCount uint, dropout float32, hasBiases bool, hasAttentionBiases bool, addsZeroAttention bool) *MLCMultiheadAttentionDescriptor

@abstract A multi-head attention layer descriptor @param modelDimension total dimension of model space @param keyDimension total dimension of key space. Default = modelDimension @param valueDimension total dimension of value space. Default = modelDimension @param headCount number of parallel attention heads @param dropout optional, a dropout layer applied to the output projection weights. Default = 0.0f @param hasBiases if true, bias will be added to query/key/value/output projections. Default = YES @param hasAttentionBiases if true, an array of biases is added to key and value respectively. Default = NO @param addsZeroAttention if true, a row of zeroes is added to projected key and value. Default = NO @return A new MultiheadAttention layer descriptor

func MLCMultiheadAttentionDescriptorFromID

func MLCMultiheadAttentionDescriptorFromID(id objc.ID) *MLCMultiheadAttentionDescriptor

func (*MLCMultiheadAttentionDescriptor) AddsZeroAttention

func (o *MLCMultiheadAttentionDescriptor) AddsZeroAttention() bool

@brief if true, a row of zeroes is added to projected key and value. Default = false

func (*MLCMultiheadAttentionDescriptor) Dropout

@brief a droupout layer applied to the output projection weights. Default = 0.0

func (*MLCMultiheadAttentionDescriptor) HasAttentionBiases

func (o *MLCMultiheadAttentionDescriptor) HasAttentionBiases() bool

@brief if true, an array of biases is added to key and value respectively. Default = false

func (*MLCMultiheadAttentionDescriptor) HasBiases

func (o *MLCMultiheadAttentionDescriptor) HasBiases() bool

@brief if true, bias is used for query/key/value/output projections. Default = true

func (*MLCMultiheadAttentionDescriptor) HeadCount

func (o *MLCMultiheadAttentionDescriptor) HeadCount() uint

@brief number of parallel attention heads

func (*MLCMultiheadAttentionDescriptor) KeyDimension

func (o *MLCMultiheadAttentionDescriptor) KeyDimension() uint

@brief total dimension of key space, Default = modelDimension

func (*MLCMultiheadAttentionDescriptor) ModelDimension

func (o *MLCMultiheadAttentionDescriptor) ModelDimension() uint

@brief model or embedding dimension

func (*MLCMultiheadAttentionDescriptor) ValueDimension

func (o *MLCMultiheadAttentionDescriptor) ValueDimension() uint

@brief total dimension of value space, Default = modelDimension

type MLCMultiheadAttentionLayer

type MLCMultiheadAttentionLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcmultiheadattentionlayer

func MLCMultiheadAttentionLayerFromID

func MLCMultiheadAttentionLayerFromID(id objc.ID) *MLCMultiheadAttentionLayer

func MLCMultiheadAttentionLayerLayerWithDescriptorWeightsBiasesAttentionBiases

func MLCMultiheadAttentionLayerLayerWithDescriptorWeightsBiasesAttentionBiases(descriptor *MLCMultiheadAttentionDescriptor, weights *foundation.NSArray[*MLCTensor], biases *foundation.NSArray[*MLCTensor], attentionBiases *foundation.NSArray[*MLCTensor]) *MLCMultiheadAttentionLayer

@abstract Create a multi-head attention layer @param weights weights corresponding to query, key, value and output projections for all heads @param biases Optional, biases corresponding to query, key, value and output projections for all heads @param attentionBiases Optional, An array of biases added to the key and value respectively @return A new MultiheadAttention layer

func (*MLCMultiheadAttentionLayer) AttentionBiases

func (o *MLCMultiheadAttentionLayer) AttentionBiases() *foundation.NSArray[*MLCTensor]

@property attentionBiases @abstract The biases added to key and value

func (*MLCMultiheadAttentionLayer) Biases

@property biases @abstract The biases of query, key, value and output projections

func (*MLCMultiheadAttentionLayer) BiasesParameters

@property biasesParameters @abstract The biases tensor parameters used for optimizer update

func (*MLCMultiheadAttentionLayer) Descriptor

@property descriptor @abstract The multi-head attention descriptor

func (*MLCMultiheadAttentionLayer) Weights

@property weights @abstract The weights of query, key, value and output projections

func (*MLCMultiheadAttentionLayer) WeightsParameters

@property weightsParameters @abstract The weights tensor parameters used for optimizer update

type MLCOptimizer

type MLCOptimizer struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcoptimizer

func MLCOptimizerFromID

func MLCOptimizerFromID(id objc.ID) *MLCOptimizer

func (*MLCOptimizer) AppliesGradientClipping

func (o *MLCOptimizer) AppliesGradientClipping() bool

@property appliesGradientClipping @abstract Whether gradient clipping should be applied or not.

func (*MLCOptimizer) CustomGlobalNorm

func (o *MLCOptimizer) CustomGlobalNorm() float32

@property customGlobalNorm @abstract Used only with MLCGradientClippingTypeByGlobalNorm. If non zero, this norm will be used in place of global norm.

func (*MLCOptimizer) GradientClipMax

func (o *MLCOptimizer) GradientClipMax() float32

@property gradientClipMax @abstract The maximum gradient value if gradient clipping is enabled before gradient is rescaled.

func (*MLCOptimizer) GradientClipMin

func (o *MLCOptimizer) GradientClipMin() float32

@property gradientClipMin @abstract The minimum gradient value if gradient clipping is enabled before gradient is rescaled.

func (*MLCOptimizer) GradientClippingType

func (o *MLCOptimizer) GradientClippingType() MLCGradientClippingType

@property gradientClippingType @abstract The type of clipping applied to gradient

func (*MLCOptimizer) GradientRescale

func (o *MLCOptimizer) GradientRescale() float32

@property gradientRescale @abstract The rescale value applied to gradients during optimizer update

func (*MLCOptimizer) LearningRate

func (o *MLCOptimizer) LearningRate() float32

@property learningRate @abstract The learning rate. This property is 'readwrite' so that callers can implement a 'decay' during training

func (*MLCOptimizer) MaximumClippingNorm

func (o *MLCOptimizer) MaximumClippingNorm() float32

@property maximumClippingNorm @abstract The maximum clipping value

func (*MLCOptimizer) RegularizationScale

func (o *MLCOptimizer) RegularizationScale() float32

@property regularizationScale @abstract The regularization scale.

func (*MLCOptimizer) RegularizationType

func (o *MLCOptimizer) RegularizationType() MLCRegularizationType

@property regularizationType @abstract The regularization type.

func (*MLCOptimizer) SetAppliesGradientClipping

func (o *MLCOptimizer) SetAppliesGradientClipping(appliesGradientClipping bool)

func (*MLCOptimizer) SetLearningRate

func (o *MLCOptimizer) SetLearningRate(learningRate float32)

type MLCOptimizerDescriptor

type MLCOptimizerDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcoptimizerdescriptor

func MLCOptimizerDescriptorDescriptorWithLearningRateGradientRescaleAppliesGradientClippingGradientClipMaxGradientClipMinRegularizationTypeRegularizationScale

func MLCOptimizerDescriptorDescriptorWithLearningRateGradientRescaleAppliesGradientClippingGradientClipMaxGradientClipMinRegularizationTypeRegularizationScale(learningRate float32, gradientRescale float32, appliesGradientClipping bool, gradientClipMax float32, gradientClipMin float32, regularizationType MLCRegularizationType, regularizationScale float32) *MLCOptimizerDescriptor

@abstract Create a MLCOptimizerDescriptor object @param learningRate The learning rate @param gradientRescale The gradient rescale value @param appliesGradientClipping Whether to apply gradient clipping @param gradientClipMax The maximum gradient value to be used with gradient clipping @param gradientClipMin The minimum gradient value to be used with gradient clipping @param regularizationType The regularization type @param regularizationScale The regularization scale @return A new MLCOptimizerDescriptor object.

func MLCOptimizerDescriptorDescriptorWithLearningRateGradientRescaleAppliesGradientClippingGradientClippingTypeGradientClipMaxGradientClipMinMaximumClippingNormCustomGlobalNormRegularizationTypeRegularizationScale

func MLCOptimizerDescriptorDescriptorWithLearningRateGradientRescaleAppliesGradientClippingGradientClippingTypeGradientClipMaxGradientClipMinMaximumClippingNormCustomGlobalNormRegularizationTypeRegularizationScale(learningRate float32, gradientRescale float32, appliesGradientClipping bool, gradientClippingType MLCGradientClippingType, gradientClipMax float32, gradientClipMin float32, maximumClippingNorm float32, customGlobalNorm float32, regularizationType MLCRegularizationType, regularizationScale float32) *MLCOptimizerDescriptor

@abstract Create an MLCOptimizerDescriptor object @param learningRate The learning rate @param gradientRescale The gradient rescale value @param appliesGradientClipping Whether to apply gradient clipping @param gradientClippingType The type of clipping applied to gradients @param gradientClipMax The maximum gradient value to be used with gradient clipping @param gradientClipMin The minimum gradient value to be used with gradient clipping @param maximumClippingNorm The maximum norm to be used with gradient clipping @param customGlobalNorm If non-zero, the norm to be used instead of calculating the global norm @param regularizationType The regularization type @param regularizationScale The regularization scale @return A new MLCOptimizerDescriptor object.

func MLCOptimizerDescriptorDescriptorWithLearningRateGradientRescaleRegularizationTypeRegularizationScale

func MLCOptimizerDescriptorDescriptorWithLearningRateGradientRescaleRegularizationTypeRegularizationScale(learningRate float32, gradientRescale float32, regularizationType MLCRegularizationType, regularizationScale float32) *MLCOptimizerDescriptor

@abstract Create a MLCOptimizerDescriptor object @param learningRate The learning rate @param gradientRescale The gradient rescale value @param regularizationType The regularization type @param regularizationScale The regularization scale @return A new MLCOptimizerDescriptor object.

func MLCOptimizerDescriptorFromID

func MLCOptimizerDescriptorFromID(id objc.ID) *MLCOptimizerDescriptor

func (*MLCOptimizerDescriptor) AppliesGradientClipping

func (o *MLCOptimizerDescriptor) AppliesGradientClipping() bool

@property appliesGradientClipping @abstract Whether gradient clipping should be applied or not. @discussion The default is false

func (*MLCOptimizerDescriptor) CustomGlobalNorm

func (o *MLCOptimizerDescriptor) CustomGlobalNorm() float32

@property customGlobalNorm @abstract Used only with MLCGradientClippingTypeByGlobalNorm. If non zero, this norm will be used in place of global norm.

func (*MLCOptimizerDescriptor) GradientClipMax

func (o *MLCOptimizerDescriptor) GradientClipMax() float32

@property gradientClipMax @abstract The maximum gradient value if gradient clipping is enabled before gradient is rescaled.

func (*MLCOptimizerDescriptor) GradientClipMin

func (o *MLCOptimizerDescriptor) GradientClipMin() float32

@property gradientClipMin @abstract The minimum gradient value if gradient clipping is enabled before gradient is rescaled.

func (*MLCOptimizerDescriptor) GradientClippingType

func (o *MLCOptimizerDescriptor) GradientClippingType() MLCGradientClippingType

@property gradientClippingType @abstract The type of clipping applied to gradient

func (*MLCOptimizerDescriptor) GradientRescale

func (o *MLCOptimizerDescriptor) GradientRescale() float32

@property gradientRescale @abstract The rescale value applied to gradients during optimizer update

func (*MLCOptimizerDescriptor) LearningRate

func (o *MLCOptimizerDescriptor) LearningRate() float32

@property learningRate @abstract The learning rate

func (*MLCOptimizerDescriptor) MaximumClippingNorm

func (o *MLCOptimizerDescriptor) MaximumClippingNorm() float32

@property maximumClippingNorm @abstract The maximum clipping value

func (*MLCOptimizerDescriptor) RegularizationScale

func (o *MLCOptimizerDescriptor) RegularizationScale() float32

@property regularizationScale @abstract The regularization scale.

func (*MLCOptimizerDescriptor) RegularizationType

func (o *MLCOptimizerDescriptor) RegularizationType() MLCRegularizationType

@property regularizationType @abstract The regularization type.

type MLCPaddingLayer

type MLCPaddingLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcpaddinglayer

func MLCPaddingLayerFromID

func MLCPaddingLayerFromID(id objc.ID) *MLCPaddingLayer

func MLCPaddingLayerLayerWithConstantPaddingConstantValue

func MLCPaddingLayerLayerWithConstantPaddingConstantValue(padding *foundation.NSArray[*foundation.NSNumber], constantValue float32) *MLCPaddingLayer

@abstract Create a padding layer with constant padding @param padding The padding sizes. @param constantValue The constant value to pad the source tensor. @return A new padding layer

func MLCPaddingLayerLayerWithReflectionPadding

func MLCPaddingLayerLayerWithReflectionPadding(padding *foundation.NSArray[*foundation.NSNumber]) *MLCPaddingLayer

@abstract Create a padding layer with reflection padding @param padding The padding sizes. @return A new padding layer

func MLCPaddingLayerLayerWithSymmetricPadding

func MLCPaddingLayerLayerWithSymmetricPadding(padding *foundation.NSArray[*foundation.NSNumber]) *MLCPaddingLayer

@abstract Create a padding layer with symmetric padding @param padding The padding sizes. @return A new padding layer

func MLCPaddingLayerLayerWithZeroPadding

func MLCPaddingLayerLayerWithZeroPadding(padding *foundation.NSArray[*foundation.NSNumber]) *MLCPaddingLayer

@abstract Create a padding layer with zero padding @param padding The padding sizes. @return A new padding layer

func (*MLCPaddingLayer) ConstantValue

func (o *MLCPaddingLayer) ConstantValue() float32

@property constantValue @abstract The constant value to use if padding type is constant.

func (*MLCPaddingLayer) PaddingBottom

func (o *MLCPaddingLayer) PaddingBottom() uint

@property paddingBottom @abstract The bottom padding size

func (*MLCPaddingLayer) PaddingLeft

func (o *MLCPaddingLayer) PaddingLeft() uint

@property paddingLeft @abstract The left padding size

func (*MLCPaddingLayer) PaddingRight

func (o *MLCPaddingLayer) PaddingRight() uint

@property paddingRight @abstract The right padding size

func (*MLCPaddingLayer) PaddingTop

func (o *MLCPaddingLayer) PaddingTop() uint

@property paddingTop @abstract The top padding size

func (*MLCPaddingLayer) PaddingType

func (o *MLCPaddingLayer) PaddingType() MLCPaddingType

@property paddingType @abstract The padding type i.e. constant, zero, reflect or symmetric

type MLCPaddingPolicy

type MLCPaddingPolicy int64
const (
	// The "same" padding policy.
	MLCPaddingPolicySame MLCPaddingPolicy = 0
	// The "valid" padding policy.
	MLCPaddingPolicyValid MLCPaddingPolicy = 1
	// The choice to use explicitly specified padding sizes.
	MLCPaddingPolicyUsePaddingSize MLCPaddingPolicy = 2
)

func (MLCPaddingPolicy) String

func (e MLCPaddingPolicy) String() string

type MLCPaddingType

type MLCPaddingType int64
const (
	// The zero padding type.
	MLCPaddingTypeZero MLCPaddingType = 0
	// The reflect padding type.
	MLCPaddingTypeReflect MLCPaddingType = 1
	// The symmetric padding type.
	MLCPaddingTypeSymmetric MLCPaddingType = 2
	// The constant padding type.
	MLCPaddingTypeConstant MLCPaddingType = 3
)

func (MLCPaddingType) String

func (e MLCPaddingType) String() string

type MLCPlatform

type MLCPlatform struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcplatform

func MLCPlatformFromID

func MLCPlatformFromID(id objc.ID) *MLCPlatform

type MLCPoolingDescriptor

type MLCPoolingDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcpoolingdescriptor

func MLCPoolingDescriptorAveragePoolingDescriptorWithKernelSizesStridesDilationRatesPaddingPolicyPaddingSizesCountIncludesPadding

func MLCPoolingDescriptorAveragePoolingDescriptorWithKernelSizesStridesDilationRatesPaddingPolicyPaddingSizesCountIncludesPadding(kernelSizes *foundation.NSArray[*foundation.NSNumber], strides *foundation.NSArray[*foundation.NSNumber], dilationRates *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber], countIncludesPadding bool) *MLCPoolingDescriptor

@abstract Create a MLCPoolingDescriptor object for an average pooling function @param kernelSizes The kernel sizes in x and y @param strides The kernel strides in x and y @param dilationRates The kernel dilation rates in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @param countIncludesPadding Whether to include zero padding in the averaging calculation @return A new MLCPoolingDescriptor object.

func MLCPoolingDescriptorAveragePoolingDescriptorWithKernelSizesStridesPaddingPolicyPaddingSizesCountIncludesPadding

func MLCPoolingDescriptorAveragePoolingDescriptorWithKernelSizesStridesPaddingPolicyPaddingSizesCountIncludesPadding(kernelSizes *foundation.NSArray[*foundation.NSNumber], strides *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber], countIncludesPadding bool) *MLCPoolingDescriptor

@abstract Create a MLCPoolingDescriptor object for an average pooling function @param kernelSizes The kernel sizes in x and y @param strides The kernel strides in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @param countIncludesPadding Whether to include zero padding in the averaging calculation @return A new MLCPoolingDescriptor object.

func MLCPoolingDescriptorFromID

func MLCPoolingDescriptorFromID(id objc.ID) *MLCPoolingDescriptor

func MLCPoolingDescriptorL2NormPoolingDescriptorWithKernelSizesStridesDilationRatesPaddingPolicyPaddingSizes

func MLCPoolingDescriptorL2NormPoolingDescriptorWithKernelSizesStridesDilationRatesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], strides *foundation.NSArray[*foundation.NSNumber], dilationRates *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCPoolingDescriptor

@abstract Create a MLCPoolingDescriptor object for a L2 norm pooling function @param kernelSizes The kernel sizes in x and y @param strides The kernel strides in x and y @param dilationRates The kernel dilation rates in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCPoolingDescriptor object.

func MLCPoolingDescriptorL2NormPoolingDescriptorWithKernelSizesStridesPaddingPolicyPaddingSizes

func MLCPoolingDescriptorL2NormPoolingDescriptorWithKernelSizesStridesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], strides *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCPoolingDescriptor

@abstract Create a MLCPoolingDescriptor object for a L2 norm pooling function @param kernelSizes The kernel sizes in x and y @param strides The kernel strides in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCPoolingDescriptor object.

func MLCPoolingDescriptorMaxPoolingDescriptorWithKernelSizesStridesDilationRatesPaddingPolicyPaddingSizes

func MLCPoolingDescriptorMaxPoolingDescriptorWithKernelSizesStridesDilationRatesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], strides *foundation.NSArray[*foundation.NSNumber], dilationRates *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCPoolingDescriptor

@abstract Create a MLCPoolingDescriptor object for a max pooling function @param kernelSizes The kernel sizes in x and y @param strides The kernel strides in x and y @param dilationRates The kernel dilation rates in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCPoolingDescriptor object.

func MLCPoolingDescriptorMaxPoolingDescriptorWithKernelSizesStridesPaddingPolicyPaddingSizes

func MLCPoolingDescriptorMaxPoolingDescriptorWithKernelSizesStridesPaddingPolicyPaddingSizes(kernelSizes *foundation.NSArray[*foundation.NSNumber], strides *foundation.NSArray[*foundation.NSNumber], paddingPolicy MLCPaddingPolicy, paddingSizes *foundation.NSArray[*foundation.NSNumber]) *MLCPoolingDescriptor

@abstract Create a MLCPoolingDescriptor object for a max pooling function @param kernelSizes The kernel sizes in x and y @param strides The kernel strides in x and y @param paddingPolicy The padding policy @param paddingSizes The padding sizes in x and y if padding policy is MLCPaddingPolicyUsePaddingSIze @return A new MLCPoolingDescriptor object.

func MLCPoolingDescriptorPoolingDescriptorWithTypeKernelSizeStride

func MLCPoolingDescriptorPoolingDescriptorWithTypeKernelSizeStride(poolingType MLCPoolingType, kernelSize uint, stride uint) *MLCPoolingDescriptor

@abstract Create a MLCPoolingDescriptor object @param poolingType The pooling function @param kernelSize The kernel sizes in x and y @param stride The kernel strides in x and y @return A new MLCPoolingDescriptor object.

func (*MLCPoolingDescriptor) CountIncludesPadding

func (o *MLCPoolingDescriptor) CountIncludesPadding() bool

@property countIncludesPadding @abstract Include the zero-padding in the averaging calculation if true. Used only with average pooling.

func (*MLCPoolingDescriptor) DilationRateInX

func (o *MLCPoolingDescriptor) DilationRateInX() uint

@property dilationRateInX @abstract The dilation rate i.e. stride of elements in the kernel in x.

func (*MLCPoolingDescriptor) DilationRateInY

func (o *MLCPoolingDescriptor) DilationRateInY() uint

@property dilationRateInY @abstract The dilation rate i.e. stride of elements in the kernel in y.

func (*MLCPoolingDescriptor) KernelHeight

func (o *MLCPoolingDescriptor) KernelHeight() uint

@property kernelHeight @abstract The pooling kernel size in y.

func (*MLCPoolingDescriptor) KernelWidth

func (o *MLCPoolingDescriptor) KernelWidth() uint

@property kernelWidth @abstract The pooling kernel size in x.

func (*MLCPoolingDescriptor) PaddingPolicy

func (o *MLCPoolingDescriptor) PaddingPolicy() MLCPaddingPolicy

@property paddingPolicy @abstract The padding policy to use.

func (*MLCPoolingDescriptor) PaddingSizeInX

func (o *MLCPoolingDescriptor) PaddingSizeInX() uint

@property paddingSizeInX @abstract The padding size in x (left and right) to use if paddingPolicy is MLCPaddingPolicyUsePaddingSize

func (*MLCPoolingDescriptor) PaddingSizeInY

func (o *MLCPoolingDescriptor) PaddingSizeInY() uint

@property paddingSizeInY @abstract The padding size in y (top and bottom) to use if paddingPolicy is MLCPaddingPolicyUsePaddingSize

func (*MLCPoolingDescriptor) PoolingType

func (o *MLCPoolingDescriptor) PoolingType() MLCPoolingType

@property poolingType @abstract The pooling operation

func (*MLCPoolingDescriptor) StrideInX

func (o *MLCPoolingDescriptor) StrideInX() uint

@property strideInX @abstract The stride of the kernel in x.

func (*MLCPoolingDescriptor) StrideInY

func (o *MLCPoolingDescriptor) StrideInY() uint

@property strideInY @abstract The stride of the kernel in y.

type MLCPoolingLayer

type MLCPoolingLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcpoolinglayer

func MLCPoolingLayerFromID

func MLCPoolingLayerFromID(id objc.ID) *MLCPoolingLayer

func MLCPoolingLayerLayerWithDescriptor

func MLCPoolingLayerLayerWithDescriptor(descriptor *MLCPoolingDescriptor) *MLCPoolingLayer

@abstract Create a pooling layer @param descriptor The pooling descriptor @return A new pooling layer

func (*MLCPoolingLayer) Descriptor

func (o *MLCPoolingLayer) Descriptor() *MLCPoolingDescriptor

@property descriptor @abstract The pooling descriptor

type MLCPoolingType

type MLCPoolingType int64
const (
	// The max pooling type.
	MLCPoolingTypeMax MLCPoolingType = 1
	// The average pooling type.
	MLCPoolingTypeAverage MLCPoolingType = 2
	// The L2-norm pooling type.
	MLCPoolingTypeL2Norm MLCPoolingType = 3
	MLCPoolingTypeCount  MLCPoolingType = 4
)

func (MLCPoolingType) String

func (e MLCPoolingType) String() string

type MLCRMSPropOptimizer

type MLCRMSPropOptimizer struct {
	MLCOptimizer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcrmspropoptimizer Deprecated: Use Metal Performance Shaders Graph or BNNS instead.

func MLCRMSPropOptimizerFromID

func MLCRMSPropOptimizerFromID(id objc.ID) *MLCRMSPropOptimizer

func MLCRMSPropOptimizerOptimizerWithDescriptor

func MLCRMSPropOptimizerOptimizerWithDescriptor(optimizerDescriptor *MLCOptimizerDescriptor) *MLCRMSPropOptimizer

@abstract Create a MLCRMSPropOptimizer object with defaults @return A new MLCRMSPropOptimizer object.

func MLCRMSPropOptimizerOptimizerWithDescriptorMomentumScaleAlphaEpsilonIsCentered

func MLCRMSPropOptimizerOptimizerWithDescriptorMomentumScaleAlphaEpsilonIsCentered(optimizerDescriptor *MLCOptimizerDescriptor, momentumScale float32, alpha float32, epsilon float32, isCentered bool) *MLCRMSPropOptimizer

@abstract Create a MLCRMSPropOptimizer object @param optimizerDescriptor The optimizer descriptor object @param momentumScale The momentum scale @param alpha The smoothing constant value @param epsilon The epsilon value to use to improve numerical stability @param isCentered A boolean to specify whether to compute the centered RMSProp or not @return A new MLCRMSPropOptimizer object.

func (*MLCRMSPropOptimizer) Alpha

func (o *MLCRMSPropOptimizer) Alpha() float32

@property alpha @abstract The smoothing constant. @discussion The default is 0.99.

func (*MLCRMSPropOptimizer) Epsilon

func (o *MLCRMSPropOptimizer) Epsilon() float32

@property epsilon @abstract A term added to improve numerical stability. @discussion The default is 1e-8.

func (*MLCRMSPropOptimizer) IsCentered

func (o *MLCRMSPropOptimizer) IsCentered() bool

@property isCentered @abstract If True, compute the centered RMSProp, the gradient is normalized by an estimation of its variance. @discussion The default is false.

func (*MLCRMSPropOptimizer) MomentumScale

func (o *MLCRMSPropOptimizer) MomentumScale() float32

@property momentumScale @abstract The momentum factor. A hyper-parameter. @discussion The default is 0.0.

type MLCRandomInitializerType

type MLCRandomInitializerType int64
const (
	MLCRandomInitializerTypeInvalid MLCRandomInitializerType = 0
	// The uniform random initializer type.
	MLCRandomInitializerTypeUniform MLCRandomInitializerType = 1
	// The glorot uniform random initializer type.
	MLCRandomInitializerTypeGlorotUniform MLCRandomInitializerType = 2
	// The Xavier random initializer type.
	MLCRandomInitializerTypeXavier MLCRandomInitializerType = 3
	MLCRandomInitializerTypeCount  MLCRandomInitializerType = 4
)

func (MLCRandomInitializerType) String

func (e MLCRandomInitializerType) String() string

type MLCReductionLayer

type MLCReductionLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcreductionlayer

func MLCReductionLayerFromID

func MLCReductionLayerFromID(id objc.ID) *MLCReductionLayer

func MLCReductionLayerLayerWithReductionTypeDimension

func MLCReductionLayerLayerWithReductionTypeDimension(reductionType MLCReductionType, dimension uint) *MLCReductionLayer

@abstract Create a reduction layer. @param reductionType The reduction type. @param dimension The reduction dimension. @return A new reduction layer.

func MLCReductionLayerLayerWithReductionTypeDimensions

func MLCReductionLayerLayerWithReductionTypeDimensions(reductionType MLCReductionType, dimensions *foundation.NSArray[*foundation.NSNumber]) *MLCReductionLayer

@abstract Create a reduction layer. @param reductionType The reduction type. @param dimensions The list of dimensions to reduce over @return A new reduction layer.

func (*MLCReductionLayer) Dimension

func (o *MLCReductionLayer) Dimension() uint

@property dimension @abstract The dimension over which to perform the reduction operation

func (*MLCReductionLayer) Dimensions

@property dimensions @abstract The dimensions over which to perform the reduction operation

func (*MLCReductionLayer) ReductionType

func (o *MLCReductionLayer) ReductionType() MLCReductionType

@property reductionType @abstract The reduction type

type MLCReductionType

type MLCReductionType int64
const (
	// No reduction.
	MLCReductionTypeNone MLCReductionType = 0
	// The sum reduction.
	MLCReductionTypeSum MLCReductionType = 1
	// The mean reduction.
	MLCReductionTypeMean MLCReductionType = 2
	// The max reduction.
	MLCReductionTypeMax MLCReductionType = 3
	// The min reduction.
	MLCReductionTypeMin MLCReductionType = 4
	// The argmax reduction.
	MLCReductionTypeArgMax MLCReductionType = 5
	// The argmin reduction.
	MLCReductionTypeArgMin MLCReductionType = 6
	// The L1norm reduction.
	MLCReductionTypeL1Norm MLCReductionType = 7
	// Any(X) = X_0 || X_1 || ... X_n
	MLCReductionTypeAny MLCReductionType = 8
	// Alf(X) = X_0 && X_1 && ... X_n
	MLCReductionTypeAll   MLCReductionType = 9
	MLCReductionTypeCount MLCReductionType = 10
)

func (MLCReductionType) String

func (e MLCReductionType) String() string

type MLCRegularizationType

type MLCRegularizationType int64
const (
	// No regularization.
	MLCRegularizationTypeNone MLCRegularizationType = 0
	// The L1 regularization.
	MLCRegularizationTypeL1 MLCRegularizationType = 1
	// The L2 regularization.
	MLCRegularizationTypeL2 MLCRegularizationType = 2
)

func (MLCRegularizationType) String

func (e MLCRegularizationType) String() string

type MLCReshapeLayer

type MLCReshapeLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcreshapelayer

func MLCReshapeLayerFromID

func MLCReshapeLayerFromID(id objc.ID) *MLCReshapeLayer

func MLCReshapeLayerLayerWithShape

func MLCReshapeLayerLayerWithShape(shape *foundation.NSArray[*foundation.NSNumber]) *MLCReshapeLayer

@abstract Creates a reshape layer with the shape you specify. @param shape An array that contains the sizes of each dimension. @return A new reshape layer.

func (*MLCReshapeLayer) Shape

@property shape @abstract The target shape.

type MLCSGDOptimizer

type MLCSGDOptimizer struct {
	MLCOptimizer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcsgdoptimizer

func MLCSGDOptimizerFromID

func MLCSGDOptimizerFromID(id objc.ID) *MLCSGDOptimizer

func MLCSGDOptimizerOptimizerWithDescriptor

func MLCSGDOptimizerOptimizerWithDescriptor(optimizerDescriptor *MLCOptimizerDescriptor) *MLCSGDOptimizer

@abstract Create an MLCSGDOptimizer object with defaults @return A new MLCSGDOptimizer object.

func MLCSGDOptimizerOptimizerWithDescriptorMomentumScaleUsesNesterovMomentum

func MLCSGDOptimizerOptimizerWithDescriptorMomentumScaleUsesNesterovMomentum(optimizerDescriptor *MLCOptimizerDescriptor, momentumScale float32, usesNesterovMomentum bool) *MLCSGDOptimizer

@abstract Create an MLCSGDOptimizer object @param optimizerDescriptor The optimizer descriptor object @param momentumScale The momentum scale @param usesNesterovMomentum A boolean to enable / disable nesterov momentum @return A new MLCSGDOptimizer object.

func (*MLCSGDOptimizer) MomentumScale

func (o *MLCSGDOptimizer) MomentumScale() float32

@property momentumScale @abstract The momentum factor. A hyper-parameter. @discussion The default is 0.0.

func (*MLCSGDOptimizer) UsesNesterovMomentum

func (o *MLCSGDOptimizer) UsesNesterovMomentum() bool

@property usesNesterovMomentum @abstract A boolean that specifies whether to apply nesterov momentum or not. @discussion The default is false.

type MLCSampleMode

type MLCSampleMode int64
const (
	// The nearest sample mode.
	MLCSampleModeNearest MLCSampleMode = 0
	// The linear sample mode.
	MLCSampleModeLinear MLCSampleMode = 1
)

func (MLCSampleMode) String

func (e MLCSampleMode) String() string

type MLCScatterLayer

type MLCScatterLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcscatterlayer

func MLCScatterLayerFromID

func MLCScatterLayerFromID(id objc.ID) *MLCScatterLayer

func MLCScatterLayerLayerWithDimensionReductionType

func MLCScatterLayerLayerWithDimensionReductionType(dimension uint, reductionType MLCReductionType) *MLCScatterLayer

@abstract Create a scatter layer @param dimension The dimension along which to index @param reductionType The reduction type to use @return A new scatter layer

func (*MLCScatterLayer) Dimension

func (o *MLCScatterLayer) Dimension() uint

@property dimension @abstract The dimension along which to index

func (*MLCScatterLayer) ReductionType

func (o *MLCScatterLayer) ReductionType() MLCReductionType

@property reductionType @abstract The reduction type applied for all values in source tensor that are scattered to a specific location in the result tensor. Must be: MLCReductionTypeNone or MLCReductionTypeSum.

type MLCSelectionLayer

type MLCSelectionLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcselectionlayer

func MLCSelectionLayerFromID

func MLCSelectionLayerFromID(id objc.ID) *MLCSelectionLayer

func MLCSelectionLayerLayer

func MLCSelectionLayerLayer() *MLCSelectionLayer

@abstract Create a select layer @return A new layer for selecting elements between two tensors.

type MLCSliceLayer

type MLCSliceLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcslicelayer

func MLCSliceLayerFromID

func MLCSliceLayerFromID(id objc.ID) *MLCSliceLayer

func MLCSliceLayerSliceLayerWithStartEndStride

func MLCSliceLayerSliceLayerWithStartEndStride(start *foundation.NSArray[*foundation.NSNumber], end *foundation.NSArray[*foundation.NSNumber], stride *foundation.NSArray[*foundation.NSNumber]) *MLCSliceLayer

@abstract Create a slice layer @param stride If set to nil, it will be set to 1. @return A new layer for slicing tensors.

func (*MLCSliceLayer) End

@property end @abstract A vector of length equal to that of source. The element at index i specifies the end of slice in dimension i.

func (*MLCSliceLayer) Start

@property start @abstract A vector of length equal to that of source. The element at index i specifies the beginning of slice in dimension i.

func (*MLCSliceLayer) Stride

@property stride @abstract A vector of length equal to that of source. The element at index i specifies the stride of slice in dimension i.

type MLCSoftmaxLayer

type MLCSoftmaxLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcsoftmaxlayer

func MLCSoftmaxLayerFromID

func MLCSoftmaxLayerFromID(id objc.ID) *MLCSoftmaxLayer

func MLCSoftmaxLayerLayerWithOperation

func MLCSoftmaxLayerLayerWithOperation(operation MLCSoftmaxOperation) *MLCSoftmaxLayer

@abstract Create a softmax layer @param operation The softmax operation @return A new softmax layer

func MLCSoftmaxLayerLayerWithOperationDimension

func MLCSoftmaxLayerLayerWithOperationDimension(operation MLCSoftmaxOperation, dimension uint) *MLCSoftmaxLayer

@abstract Create a softmax layer @param operation The softmax operation @param dimension The dimension over which softmax operation should be performed @return A new softmax layer

func (*MLCSoftmaxLayer) Dimension

func (o *MLCSoftmaxLayer) Dimension() uint

@property dimension @abstract The dimension over which softmax operation should be performed

func (*MLCSoftmaxLayer) Operation

func (o *MLCSoftmaxLayer) Operation() MLCSoftmaxOperation

@property operation @abstract The softmax operation. Supported values are softmax and log softmax.

type MLCSoftmaxOperation

type MLCSoftmaxOperation int64
const (
	// The standard softmax operation.
	MLCSoftmaxOperationSoftmax MLCSoftmaxOperation = 0
	// The log softmax operation.
	MLCSoftmaxOperationLogSoftmax MLCSoftmaxOperation = 1
)

func (MLCSoftmaxOperation) String

func (e MLCSoftmaxOperation) String() string

type MLCSplitLayer

type MLCSplitLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcsplitlayer

func MLCSplitLayerFromID

func MLCSplitLayerFromID(id objc.ID) *MLCSplitLayer

func MLCSplitLayerLayerWithSplitCountDimension

func MLCSplitLayerLayerWithSplitCountDimension(splitCount uint, dimension uint) *MLCSplitLayer

@abstract Create a split layer @param splitCount The number of splits. @param dimension The dimension along which the tensor should be split. @return A new split layer

func MLCSplitLayerLayerWithSplitSectionLengthsDimension

func MLCSplitLayerLayerWithSplitSectionLengthsDimension(splitSectionLengths *foundation.NSArray[*foundation.NSNumber], dimension uint) *MLCSplitLayer

@abstract Create a split layer @param splitSectionLengths Lengths of each split section. @param dimension The dimension along which the tensor should be split. @return A new split layer

func (*MLCSplitLayer) Dimension

func (o *MLCSplitLayer) Dimension() uint

@property dimension @abstract The dimension (or axis) along which to split tensor

func (*MLCSplitLayer) SplitCount

func (o *MLCSplitLayer) SplitCount() uint

@property splitCount @abstract The number of splits. @discussion The tensor will be split into equally sized chunks. The last chunk may be smaller in size.

func (*MLCSplitLayer) SplitSectionLengths

func (o *MLCSplitLayer) SplitSectionLengths() *foundation.NSArray[*foundation.NSNumber]

@property splitSectionLengths @abstract Lengths of each split section. @discussion The tensor will be split into chunks along dimensions with sizes given in \p splitSectionLengths .

type MLCTensor

type MLCTensor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlctensor

func MLCTensorFromID

func MLCTensorFromID(id objc.ID) *MLCTensor

func MLCTensorTensorWithDescriptor

func MLCTensorTensorWithDescriptor(tensorDescriptor *MLCTensorDescriptor) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object without any data @return A new MLCTensor object

func MLCTensorTensorWithDescriptorData

func MLCTensorTensorWithDescriptorData(tensorDescriptor *MLCTensorDescriptor, data *MLCTensorData) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object with a MLCTensorData object that specifies the tensor data buffer @param tensorDescriptor The tensor descriptor @param data The random initializer type @return A new MLCTensor object

func MLCTensorTensorWithDescriptorFillWithData

func MLCTensorTensorWithDescriptorFillWithData(tensorDescriptor *MLCTensorDescriptor, fillData *foundation.NSNumber) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object with a MLCTensorData object that specifies the tensor data buffer @param tensorDescriptor The tensor descriptor @param fillData The scalar data to fill to tensor with @return A new MLCTensor object

func MLCTensorTensorWithDescriptorRandomInitializerType

func MLCTensorTensorWithDescriptorRandomInitializerType(tensorDescriptor *MLCTensorDescriptor, randomInitializerType MLCRandomInitializerType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object initialized with a random initializer such as Glorot Uniform. @param tensorDescriptor The tensor descriptor @param randomInitializerType The random initializer type @return A new MLCTensor object

func MLCTensorTensorWithSequenceLengthFeatureChannelCountBatchSize

func MLCTensorTensorWithSequenceLengthFeatureChannelCountBatchSize(sequenceLength uint, featureChannelCount uint, batchSize uint) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor typically used by a recurrent layer The tensor data type is MLCDataTypeFloat32. @param sequenceLength The length of sequences stored in the tensor @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @return A new MLCTensor object

func MLCTensorTensorWithSequenceLengthFeatureChannelCountBatchSizeData

func MLCTensorTensorWithSequenceLengthFeatureChannelCountBatchSizeData(sequenceLength uint, featureChannelCount uint, batchSize uint, data *MLCTensorData) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor typically used by a recurrent layer The tensor data type is MLCDataTypeFloat32. @param sequenceLength The length of sequences stored in the tensor @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param data The tensor data @return A new MLCTensor object

func MLCTensorTensorWithSequenceLengthFeatureChannelCountBatchSizeRandomInitializerType

func MLCTensorTensorWithSequenceLengthFeatureChannelCountBatchSizeRandomInitializerType(sequenceLength uint, featureChannelCount uint, batchSize uint, randomInitializerType MLCRandomInitializerType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor typically used by a recurrent layer The tensor data type is MLCDataTypeFloat32. @param sequenceLength The length of sequences stored in the tensor @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param randomInitializerType The random initializer type @return A new MLCTensor object

func MLCTensorTensorWithSequenceLengthsSortedSequencesFeatureChannelCountBatchSizeData

func MLCTensorTensorWithSequenceLengthsSortedSequencesFeatureChannelCountBatchSizeData(sequenceLengths *foundation.NSArray[*foundation.NSNumber], sortedSequences bool, featureChannelCount uint, batchSize uint, data *MLCTensorData) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor of variable length sequences typically used by a recurrent layer The tensor data type is MLCDataTypeFloat32. @param sequenceLengths An array of sequence lengths @param sortedSequences A flag to indicate if the sequence lengths are sorted. If yes, they must be sorted in descending order @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param data The tensor data @return A new MLCTensor object

func MLCTensorTensorWithSequenceLengthsSortedSequencesFeatureChannelCountBatchSizeRandomInitializerType

func MLCTensorTensorWithSequenceLengthsSortedSequencesFeatureChannelCountBatchSizeRandomInitializerType(sequenceLengths *foundation.NSArray[*foundation.NSNumber], sortedSequences bool, featureChannelCount uint, batchSize uint, randomInitializerType MLCRandomInitializerType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor of variable length sequences typically used by a recurrent layer The tensor data type is MLCDataTypeFloat32. @param sequenceLengths An array of sequence lengths @param sortedSequences A flag to indicate if the sequence lengths are sorted. If yes, they must be sorted in descending order @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param randomInitializerType The random initializer type @return A new MLCTensor object

func MLCTensorTensorWithShape

func MLCTensorTensorWithShape(shape *foundation.NSArray[*foundation.NSNumber]) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object without any data. The tensor data type is MLCDataTypeFloat32. @param shape The tensor shape @return A new MLCTensor object

func MLCTensorTensorWithShapeDataDataType

func MLCTensorTensorWithShapeDataDataType(shape *foundation.NSArray[*foundation.NSNumber], data *MLCTensorData, dataType MLCDataType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object with data @param shape The tensor shape @param data The tensor data @param dataType The tensor data type @return A new MLCTensor object

func MLCTensorTensorWithShapeDataType

func MLCTensorTensorWithShapeDataType(shape *foundation.NSArray[*foundation.NSNumber], dataType MLCDataType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object without any data @param shape The tensor shape @param dataType The tensor data type @return A new MLCTensor object

func MLCTensorTensorWithShapeFillWithDataDataType

func MLCTensorTensorWithShapeFillWithDataDataType(shape *foundation.NSArray[*foundation.NSNumber], fillData *foundation.NSNumber, dataType MLCDataType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object with data @param shape The tensor shape @param fillData The scalar value to initialize the tensor data with @param dataType The tensor data type @return A new MLCTensor object

func MLCTensorTensorWithShapeRandomInitializerType

func MLCTensorTensorWithShapeRandomInitializerType(shape *foundation.NSArray[*foundation.NSNumber], randomInitializerType MLCRandomInitializerType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object initialized with a random initializer such as Glorot Uniform. The tensor data type is MLCDataTypeFloat32 @param shape The tensor shape @param randomInitializerType The random initializer type @return A new MLCTensor object

func MLCTensorTensorWithShapeRandomInitializerTypeDataType

func MLCTensorTensorWithShapeRandomInitializerTypeDataType(shape *foundation.NSArray[*foundation.NSNumber], randomInitializerType MLCRandomInitializerType, dataType MLCDataType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a tensor object initialized with a random initializer such as Glorot Uniform. The tensor data type is MLCDataTypeFloat32 @param shape The tensor shape @param randomInitializerType The random initializer type @param dataType The tensor data type @return A new MLCTensor object

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSize

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSize(width uint, height uint, featureChannelCount uint, batchSize uint) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a NCHW tensor object with tensor data type = MLCDataTypeFloat32 @param width The tensor width @param height The tensor height @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @return A new MLCTensor object

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeData

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeData(width uint, height uint, featureChannelCount uint, batchSize uint, data *MLCTensorData) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a NCHW tensor object with a tensor data object The tensor data type is MLCDataTypeFloat32. @param width The tensor width @param height The tensor height @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param data The tensor data @return A new MLCTensor object

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeDataDataType

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeDataDataType(width uint, height uint, featureChannelCount uint, batchSize uint, data *MLCTensorData, dataType MLCDataType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a NCHW tensor object with a tensor data object The tensor data type is MLCDataTypeFloat32. @param width The tensor width @param height The tensor height @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param data The tensor data @param dataType The tensor data type @return A new MLCTensor object

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeFillWithDataDataType

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeFillWithDataDataType(width uint, height uint, featureChannelCount uint, batchSize uint, fillData float32, dataType MLCDataType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a NCHW tensor object initialized with a scalar value @param width The tensor width @param height The tensor height @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param fillData The scalar value to initialize the tensor data with @param dataType The tensor data type @return A new MLCTensorData object

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeRandomInitializerType

func MLCTensorTensorWithWidthHeightFeatureChannelCountBatchSizeRandomInitializerType(width uint, height uint, featureChannelCount uint, batchSize uint, randomInitializerType MLCRandomInitializerType) *MLCTensor

@abstract Create a MLCTensor object @discussion Create a NCHW tensor object initialized with a random initializer type. The tensor data type is MLCDataTypeFloat32 @param width The tensor width @param height The tensor height @param featureChannelCount Number of feature channels @param batchSize The tensor batch size @param randomInitializerType The random initializer type @return A new MLCTensor object

func (*MLCTensor) BindAndWriteDataToDevice

func (o *MLCTensor) BindAndWriteDataToDevice(data *MLCTensorData, device *MLCDevice) bool

@abstract Associates the given data to the tensor. If the device is GPU, also copies the data to the device memory. Returns true if the data is successfully associated with the tensor and copied to the device. @discussion The caller must guarantee the lifetime of the underlying memory of \p data for the entirety of the tensor's lifetime. For input tensors, we recommend that the bindAndwriteData method provided by MLCTrainingGraph and MLCInferenceGraph be used. This method should only be used to allocate and copy data to device memory for tensors that are typically layer parameters such as weights, bias for convolution layers, beta, gamma for normalization layers. @param data The data to associated with the tensor @param device The compute device @return A Boolean value indicating whether the data is successfully associated with the tensor and copied to the device.

func (*MLCTensor) BindOptimizerDataDeviceData

func (o *MLCTensor) BindOptimizerDataDeviceData(data *foundation.NSArray[*MLCTensorData], deviceData *foundation.NSArray[*MLCTensorOptimizerDeviceData]) bool

@abstract Associates the given optimizer data and device data buffers to the tensor. Returns true if the data is successfully associated with the tensor and copied to the device. @discussion The caller must guarantee the lifetime of the underlying memory of \p data for the entirety of the tensor's lifetime. The \p deviceData buffers are allocated by MLCompute. This method must be called before executeOptimizerUpdateWithOptions or executeWithInputsData is called for the training graph. @param data The optimizer data to be associated with the tensor @param deviceData The optimizer device data to be associated with the tensor @return A Boolean value indicating whether the data is successfully associated with the tensor .

func (*MLCTensor) CopyDataFromDeviceMemoryToBytesLengthSynchronizeWithDevice

func (o *MLCTensor) CopyDataFromDeviceMemoryToBytesLengthSynchronizeWithDevice(bytes_ unsafe.Pointer, length uint, synchronizeWithDevice bool) bool

@abstract Copy tensor data from device memory to user specified memory @discussion Before copying tensor data from device memory, one may need to synchronize the device memory for example when device is the GPU. The synchronizeWithDevice argumet can be set appropraitely to indicate this. For CPU this is ignored. If the tensor has been specified in outputs of a graph using addOutputs, synchronizeWithDevice should be set to NO. NOTE: This method should only be called once the graph that this tensor is used with has finished execution; Otherwise the results in device memory may not be up to date. synchronizeWithDevice must be set to NO when this method is called from a completion callback for GPU. @param bytes The user specified data in which to copy @param length The size in bytes to copy @param synchronizeWithDevice Whether to synchronize device memory if device is GPU @return Returns YES if success, NO if there is a failure to synchronize

func (*MLCTensor) Data

func (o *MLCTensor) Data() *foundation.NSData

@property data @abstract The tensor data

func (*MLCTensor) Descriptor

func (o *MLCTensor) Descriptor() *MLCTensorDescriptor

@property descriptor @abstract The tensor descriptor

func (*MLCTensor) Device

func (o *MLCTensor) Device() *MLCDevice

@property device @abstract The device associated with this tensor.

func (*MLCTensor) HasValidNumerics

func (o *MLCTensor) HasValidNumerics() bool

@abstract Returns a Boolean value indicating whether the underlying data has valid floating-point numerics, i.e. it does not contain NaN or INF floating-point values.

func (*MLCTensor) Label

func (o *MLCTensor) Label() *foundation.NSString

@property label @abstract A string to help identify this object.

func (*MLCTensor) OptimizerData

func (o *MLCTensor) OptimizerData() *foundation.NSArray[*MLCTensorData]

@property optimizer buffers to use if tensor is used as a parameter @abstract These are the host side optimizer (momentum and velocity) buffers which developers can query and initialize @discussion When customizing optimizer data, the contents of these buffers must be initialized before executing optimizer update for a graph.

func (*MLCTensor) OptimizerDeviceData

func (o *MLCTensor) OptimizerDeviceData() *foundation.NSArray[*MLCTensorOptimizerDeviceData]

@property optimizer device buffers to use if tensor is used as a parameter @abstract These are the device side optimizer (momentum and velocity) buffers which developers can query

func (*MLCTensor) SetLabel

func (o *MLCTensor) SetLabel(label *foundation.NSString)

func (*MLCTensor) SynchronizeData

func (o *MLCTensor) SynchronizeData() bool

@abstract Synchronize the data in host memory. @discussion Synchronize the data in host memory i.e. tensor.data with latest contents in device memory This should only be called once the graph that this tensor is used with has finished execution; Otherwise the results in device memory may not be up to date. NOTE: This method should not be called from a completion callback when device is the GPU. @return Returns YES if success, NO if there is a failure to synchronize

func (*MLCTensor) SynchronizeOptimizerData

func (o *MLCTensor) SynchronizeOptimizerData() bool

@abstract Synchronize the optimizer data in host memory. @discussion Synchronize the optimizer data in host memory with latest contents in device memory This should only be called once the graph that this tensor is used with has finished execution; Otherwise the results in device memory may not be up to date. NOTE: This method should not be called from a completion callback when device is the GPU. @return Returns YES if success, NO if there is a failure to synchronize

func (*MLCTensor) TensorByDequantizingToTypeScaleBias

func (o *MLCTensor) TensorByDequantizingToTypeScaleBias(type_ MLCDataType, scale *MLCTensor, bias *MLCTensor) *MLCTensor

@abstract Converts a quantized tensor to a 32-bit floating-point tensor Returns a de-quantized tensor @param type The de-quantized data type. Must be MLCFloat32 @param scale The scale thst was used for the quantized data @param bias The offset value that maps to float zero used for the quantized data @return A quantized tensor

func (*MLCTensor) TensorByDequantizingToTypeScaleBiasAxis

func (o *MLCTensor) TensorByDequantizingToTypeScaleBiasAxis(type_ MLCDataType, scale *MLCTensor, bias *MLCTensor, axis int) *MLCTensor

@abstract Converts a quantized tensor to a 32-bit floating-point tensor Returns a de-quantized tensor @param type The de-quantized data type. Must be MLCFloat32 @param scale The scale thst was used for the quantized data @param bias The offset value that maps to float zero used for the quantized data @param axis The dimension on which to apply per-channel quantization @return A quantized tensor

func (*MLCTensor) TensorByQuantizingToTypeScaleBias

func (o *MLCTensor) TensorByQuantizingToTypeScaleBias(type_ MLCDataType, scale float32, bias int) *MLCTensor

@abstract Converts a 32-bit floating-point tensor with given scale and a zero point Returns a quantized tensor @param type The quantized data type. Must be MLCDataTypeInt8, MLCDataTypeUInt8 or MLCDataTypeInt32 @param scale The scale to apply in quantization @param bias The offset value that maps to float zero @return A quantized tensor

func (*MLCTensor) TensorByQuantizingToTypeScaleBiasAxis

func (o *MLCTensor) TensorByQuantizingToTypeScaleBiasAxis(type_ MLCDataType, scale *MLCTensor, bias *MLCTensor, axis int) *MLCTensor

@abstract Converts a 32-bit floating-point tensor with given scale and a zero point Returns a quantized tensor @param type The quantized data type. Must be MLCDataTypeInt8, MLCDataTypeUInt8 or MLCDataTypeInt32 @param scale The scale to apply in quantization @param bias The offset value that maps to float zero @param axis The dimension on which to apply per-channel quantization @return A quantized tensor

func (*MLCTensor) TensorID

func (o *MLCTensor) TensorID() uint

@property tensorID @abstract The tensor ID @discussion A unique number to identify each tensor. Assigned when the tensor is created.

type MLCTensorData

type MLCTensorData struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlctensordata

func MLCTensorDataDataWithBytesNoCopyLength

func MLCTensorDataDataWithBytesNoCopyLength(bytes_ unsafe.Pointer, length uint) *MLCTensorData

@abstract Creates a data object that holds a given number of bytes from a given buffer. @note The returned object will not take ownership of the \p bytes pointer and thus will not free it on deallocation. @param bytes A buffer containing data for the new object. @param length The number of bytes to hold from \p bytes. This value must not exceed the length of \p bytes. @return A new \p MLCTensorData object.

func MLCTensorDataDataWithBytesNoCopyLengthDeallocator

func MLCTensorDataDataWithBytesNoCopyLengthDeallocator(bytes_ unsafe.Pointer, length uint, deallocator func(unsafe.Pointer, uint)) *MLCTensorData

@absract Creates a data object that holds a given number of bytes from a given buffer. with a custom deallocator block. @param bytes A buffer containing data for the new object. @param length The number of bytes to hold from \p bytes. This value must not exceed the length of \p bytes. @param deallocator A block to invoke when the resulting object is deallocated. @return A new \p MLCTensorData object.

func MLCTensorDataDataWithImmutableBytesNoCopyLength

func MLCTensorDataDataWithImmutableBytesNoCopyLength(bytes_ unsafe.Pointer, length uint) *MLCTensorData

@abstract Creates a data object that holds a given number of bytes from a given buffer. @note The returned object will not take ownership of the \p bytes pointer and thus will not free it on deallocation. The underlying bytes in the return object should not be mutated. @param bytes A buffer containing data for the new object. @param length The number of bytes to hold from \p bytes. This value must not exceed the length of \p bytes. @return A new \p MLCTensorData object.

func MLCTensorDataFromID

func MLCTensorDataFromID(id objc.ID) *MLCTensorData

func (*MLCTensorData) Bytes

func (o *MLCTensorData) Bytes() unsafe.Pointer

@property bytes @abstract Pointer to memory that contains or will be used for tensor data

func (*MLCTensorData) Length

func (o *MLCTensorData) Length() uint

@property length @abstract The size in bytes of the tensor data

type MLCTensorDescriptor

type MLCTensorDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlctensordescriptor

func MLCTensorDescriptorConvolutionBiasesDescriptorWithFeatureChannelCountDataType

func MLCTensorDescriptorConvolutionBiasesDescriptorWithFeatureChannelCountDataType(featureChannelCount uint, dataType MLCDataType) *MLCTensorDescriptor

@abstract Create a MLCTensorDescriptor object @param featureChannelCount The number of input feature channels @param dataType The tensor data type @return A new MLCTensorDescriptor object or nil if failure. @discussion This method is provided as an easy to use API to create a bias tensor.

func MLCTensorDescriptorConvolutionWeightsDescriptorWithInputFeatureChannelCountOutputFeatureChannelCountDataType

func MLCTensorDescriptorConvolutionWeightsDescriptorWithInputFeatureChannelCountOutputFeatureChannelCountDataType(inputFeatureChannelCount uint, outputFeatureChannelCount uint, dataType MLCDataType) *MLCTensorDescriptor

@abstract Create a MLCTensorDescriptor object @param inputFeatureChannelCount The number of input feature channels @param outputFeatureChannelCount The number of output feature channels @param dataType The tensor data type @return A new MLCTensorDescriptor object or nil if failure. @discussion This method is provided as an easy to use API to create a weight tensor for a kernel of size 1.

func MLCTensorDescriptorConvolutionWeightsDescriptorWithWidthHeightInputFeatureChannelCountOutputFeatureChannelCountDataType

func MLCTensorDescriptorConvolutionWeightsDescriptorWithWidthHeightInputFeatureChannelCountOutputFeatureChannelCountDataType(width uint, height uint, inputFeatureChannelCount uint, outputFeatureChannelCount uint, dataType MLCDataType) *MLCTensorDescriptor

@abstract Create a MLCTensorDescriptor object @param width The tensor width @param height The tensor height @param inputFeatureChannelCount The number of input feature channels @param outputFeatureChannelCount The number of output feature channels @param dataType The tensor data type @return A new MLCTensorDescriptor object or nil if failure. @discussion This method is provided as an easy to use API to create a weight tensor.

func MLCTensorDescriptorDescriptorWithShapeDataType

func MLCTensorDescriptorDescriptorWithShapeDataType(shape *foundation.NSArray[*foundation.NSNumber], dataType MLCDataType) *MLCTensorDescriptor

@abstract Create a MLCTensorDescriptor object @param shape The tensor shape @param dataType The tensor data type @return A new MLCTensorDescriptor object or nil if failure.

func MLCTensorDescriptorDescriptorWithShapeSequenceLengthsSortedSequencesDataType

func MLCTensorDescriptorDescriptorWithShapeSequenceLengthsSortedSequencesDataType(shape *foundation.NSArray[*foundation.NSNumber], sequenceLengths *foundation.NSArray[*foundation.NSNumber], sortedSequences bool, dataType MLCDataType) *MLCTensorDescriptor

@abstract Create a MLCTensorDescriptor object @param shape The tensor shape @param sequenceLengths The sequence lengths in tensor @param sortedSequences A boolean to indicate whether sequences are sorted @param dataType The tensor data type @return A new MLCTensorDescriptor object or nil if failure. @discussion This method is provided as an easy to use API to create sequence tensors used by recurrent layers.

func MLCTensorDescriptorDescriptorWithWidthHeightFeatureChannelCountBatchSize

func MLCTensorDescriptorDescriptorWithWidthHeightFeatureChannelCountBatchSize(width uint, height uint, featureChannels uint, batchSize uint) *MLCTensorDescriptor

@abstract Create a MLCTensorDescriptor object @param width The tensor width @param height The tensor height @param featureChannels The number of feature channels @param batchSize The batch size @return A new MLCTensorDescriptor object or nil if failure. @discussion This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.

func MLCTensorDescriptorDescriptorWithWidthHeightFeatureChannelCountBatchSizeDataType

func MLCTensorDescriptorDescriptorWithWidthHeightFeatureChannelCountBatchSizeDataType(width uint, height uint, featureChannelCount uint, batchSize uint, dataType MLCDataType) *MLCTensorDescriptor

@abstract Create a MLCTensorDescriptor object @param width The tensor width @param height The tensor height @param featureChannelCount The number of feature channels @param batchSize The batch size @param dataType The tensor data type @return A new MLCTensorDescriptor object or nil if failure. @discussion This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.

func MLCTensorDescriptorFromID

func MLCTensorDescriptorFromID(id objc.ID) *MLCTensorDescriptor

func (*MLCTensorDescriptor) BatchSizePerSequenceStep

func (o *MLCTensorDescriptor) BatchSizePerSequenceStep() *foundation.NSArray[*foundation.NSNumber]

@property batchSizePerSequenceStep @abstract The batch size for each sequence @discussion We populate this only when sequenceLengths is valid. The length of this array should be the maximum sequence length in sequenceLengths (i.e sequenceLengths[0]).

func (*MLCTensorDescriptor) DataType

func (o *MLCTensorDescriptor) DataType() MLCDataType

@property dataType @abstract The tensor data type. The default is MLCDataTypeFloat32.

func (*MLCTensorDescriptor) DimensionCount

func (o *MLCTensorDescriptor) DimensionCount() uint

@property dimensionCount @abstract The number of dimensions in the tensor

func (*MLCTensorDescriptor) SequenceLengths

func (o *MLCTensorDescriptor) SequenceLengths() *foundation.NSArray[*foundation.NSNumber]

@property sequenceLengths @abstract TODO

func (*MLCTensorDescriptor) Shape

@property shape @abstract The size in each dimension

func (*MLCTensorDescriptor) SortedSequences

func (o *MLCTensorDescriptor) SortedSequences() bool

@property sortedSequences @abstract Specifies whether the sequences are sorted or not.

func (*MLCTensorDescriptor) Stride

@property stride @abstract The stride in bytes in each dimension

func (*MLCTensorDescriptor) TensorAllocationSizeInBytes

func (o *MLCTensorDescriptor) TensorAllocationSizeInBytes() uint

@property tensorAllocationSizeInBytes @abstract The allocation size in bytes for a tensor.

type MLCTensorOptimizerDeviceData

type MLCTensorOptimizerDeviceData struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlctensoroptimizerdevicedata

func MLCTensorOptimizerDeviceDataFromID

func MLCTensorOptimizerDeviceDataFromID(id objc.ID) *MLCTensorOptimizerDeviceData

type MLCTensorParameter

type MLCTensorParameter struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlctensorparameter

func MLCTensorParameterFromID

func MLCTensorParameterFromID(id objc.ID) *MLCTensorParameter

func MLCTensorParameterParameterWithTensor

func MLCTensorParameterParameterWithTensor(tensor *MLCTensor) *MLCTensorParameter

@abstract Create a tensor parameter @param tensor The unedrlying tensor @return A new tensor parameter object

func MLCTensorParameterParameterWithTensorOptimizerData

func MLCTensorParameterParameterWithTensorOptimizerData(tensor *MLCTensor, optimizerData *foundation.NSArray[*MLCTensorData]) *MLCTensorParameter

@abstract Create a tensor parameter @param tensor The unedrlying tensor @param optimizerData The optimizer data needed for this input tensor @return A new tensor parameter object

func (*MLCTensorParameter) IsUpdatable

func (o *MLCTensorParameter) IsUpdatable() bool

@property isUpdatable @abstract Specifies whether this tensor parameter is updatable

func (*MLCTensorParameter) SetIsUpdatable

func (o *MLCTensorParameter) SetIsUpdatable(isUpdatable bool)

func (*MLCTensorParameter) Tensor

func (o *MLCTensorParameter) Tensor() *MLCTensor

@property tensor @abstract The underlying tensor

type MLCTrainingGraph

type MLCTrainingGraph struct {
	MLCGraph
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlctraininggraph

func MLCTrainingGraphFromID

func MLCTrainingGraphFromID(id objc.ID) *MLCTrainingGraph

func MLCTrainingGraphGraphWithGraphObjectsLossLayerOptimizer

func MLCTrainingGraphGraphWithGraphObjectsLossLayerOptimizer(graphObjects *foundation.NSArray[*MLCGraph], lossLayer *MLCLayer, optimizer *MLCOptimizer) *MLCTrainingGraph

@abstract Create a training graph @param graphObjects The layers from these graph objects will be added to the training graph @param lossLayer The loss layer to use. The loss layer can also be added to the training graph using nodeWithLayer:sources:lossLabels @param optimizer The optimizer to use @return A new training graph object

func (*MLCTrainingGraph) AddInputsLossLabels

@abstract Add the list of inputs to the training graph @param inputs The inputs @param lossLabels The loss label inputs @return A boolean indicating success or failure

func (*MLCTrainingGraph) AddInputsLossLabelsLossLabelWeights

func (o *MLCTrainingGraph) AddInputsLossLabelsLossLabelWeights(inputs *foundation.NSDictionary[*foundation.NSString, *MLCTensor], lossLabels *foundation.NSDictionary[*foundation.NSString, *MLCTensor], lossLabelWeights *foundation.NSDictionary[*foundation.NSString, *MLCTensor]) bool

@abstract Add the list of inputs to the training graph @discussion Each input, loss label or label weights tensor is identified by a NSString. When the training graph is executed, this NSString is used to identify which data object should be as input data for each tensor whose device memory needs to be updated before the graph is executed. @param inputs The inputs @param lossLabels The loss label inputs @param lossLabelWeights The loss label weights @return A boolean indicating success or failure

func (*MLCTrainingGraph) AddOutputs

@abstract Add the list of outputs to the training graph @param outputs The outputs @return A boolean indicating success or failure

func (*MLCTrainingGraph) AllocateUserGradientForTensor

func (o *MLCTrainingGraph) AllocateUserGradientForTensor(tensor *MLCTensor) *MLCTensor

@abstract Allocate an entry for a user specified gradient for a tensor @param tensor A result tensor produced by a layer in the training graph that is input to some user specified code and will need to provide a user gradient during the gradient pass. @return A gradient tensor

func (*MLCTrainingGraph) BindOptimizerDataDeviceDataWithTensor

func (o *MLCTrainingGraph) BindOptimizerDataDeviceDataWithTensor(data *foundation.NSArray[*MLCTensorData], deviceData *foundation.NSArray[*MLCTensorOptimizerDeviceData], tensor *MLCTensor) bool

@abstract Associates the given optimizer data and device data buffers with the tensor. Returns true if the data is successfully associated with the tensor and copied to the device. @discussion The caller must guarantee the lifetime of the underlying memory of \p data for the entirety of the tensor's lifetime. The \p deviceData buffers are allocated by MLCompute. This method must be called before executeOptimizerUpdateWithOptions or executeWithInputsData is called for the training graph. We recommend using this method instead of using [MLCTensor bindOptimizerData] especially if the optimizer update is being called multiple times for each batch. @param data The optimizer data to be associated with the tensor @param deviceData The optimizer device data to be associated with the tensor @param tensor The tensor @return A Boolean value indicating whether the data is successfully associated with the tensor .

func (*MLCTrainingGraph) CompileOptimizer

func (o *MLCTrainingGraph) CompileOptimizer(optimizer *MLCOptimizer) bool

@abstract Compile the optimizer to be used with a training graph. @discussion Typically the optimizer to be used with a training graph is specifed when the training graph is created using graphWithGraphObjects:lossLayer:optimizer. The optimizer will be compiled in when compileWithOptions:device is called if an optimizer is specified with the training graph. In the case where the optimizer to be used is not known when the graph is created or compiled, this method can be used to associate and compile a training graph with an optimizer. @param optimizer The MLCOptimizer object @return A boolean indicating success or failure

func (*MLCTrainingGraph) CompileWithOptionsDevice

func (o *MLCTrainingGraph) CompileWithOptionsDevice(options MLCGraphCompilationOptions, device *MLCDevice) bool

@abstract Compile the training graph for a device. @param options The compiler options to use when compiling the training graph @param device The MLCDevice object @return A boolean indicating success or failure

func (*MLCTrainingGraph) CompileWithOptionsDeviceInputTensorsInputTensorsData

func (o *MLCTrainingGraph) CompileWithOptionsDeviceInputTensorsInputTensorsData(options MLCGraphCompilationOptions, device *MLCDevice, inputTensors *foundation.NSDictionary[*foundation.NSString, *MLCTensor], inputTensorsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData]) bool

@abstract Compile the training graph for a device. @discussion Specifying the list of constant tensors when we compile the graph allows MLCompute to perform additional optimizations at compile time. @param options The compiler options to use when compiling the training graph @param device The MLCDevice object @param inputTensors The list of input tensors that are constants @param inputTensorsData The tensor data to be used with these constant input tensors @return A boolean indicating success or failure

func (*MLCTrainingGraph) DeviceMemorySize

func (o *MLCTrainingGraph) DeviceMemorySize() uint

@property The device memory size used by the training graph @abstract Returns the total size in bytes of device memory used for all intermediate tensors for forward, gradient passes and optimizer update for all layers in the training graph. We recommend executing an iteration before checking the device memory size as the buffers needed get allocated when the corresponding pass such as gradient, optimizer update is executed. @return A NSUInteger value

func (*MLCTrainingGraph) ExecuteForwardWithBatchSizeOptionsCompletionHandler

func (o *MLCTrainingGraph) ExecuteForwardWithBatchSizeOptionsCompletionHandler(batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the forward pass of the training graph @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCTrainingGraph) ExecuteForwardWithBatchSizeOptionsOutputsDataCompletionHandler

func (o *MLCTrainingGraph) ExecuteForwardWithBatchSizeOptionsOutputsDataCompletionHandler(batchSize uint, options MLCExecutionOptions, outputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the forward pass for the training graph @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param outputsData The data objects to use for outputs @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCTrainingGraph) ExecuteGradientWithBatchSizeOptionsCompletionHandler

func (o *MLCTrainingGraph) ExecuteGradientWithBatchSizeOptionsCompletionHandler(batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the gradient pass of the training graph @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCTrainingGraph) ExecuteGradientWithBatchSizeOptionsOutputsDataCompletionHandler

func (o *MLCTrainingGraph) ExecuteGradientWithBatchSizeOptionsOutputsDataCompletionHandler(batchSize uint, options MLCExecutionOptions, outputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the gradient pass of the training graph @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param outputsData The data objects to use for outputs @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCTrainingGraph) ExecuteOptimizerUpdateWithOptionsCompletionHandler

func (o *MLCTrainingGraph) ExecuteOptimizerUpdateWithOptionsCompletionHandler(options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the optimizer update pass of the training graph @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCTrainingGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataBatchSizeOptionsCompletionHandler

func (o *MLCTrainingGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataBatchSizeOptionsCompletionHandler(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelWeightsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the training graph (forward, gradient and optimizer update) with given source and label data @discussion Execute the training graph with given source and label data. If an optimizer is specified, the optimizer update is applied. If MLCExecutionOptionsSynchronous is specified in 'options', this method returns after the graph has been executed. Otherwise, this method returns after the graph has been queued for execution. The completion handler is called after the graph has finished execution. @param inputsData The data objects to use for inputs @param lossLabelsData The data objects to use for loss labels @param lossLabelWeightsData The data objects to use for loss label weights @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCTrainingGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataOutputsDataBatchSizeOptionsCompletionHandler

func (o *MLCTrainingGraph) ExecuteWithInputsDataLossLabelsDataLossLabelWeightsDataOutputsDataBatchSizeOptionsCompletionHandler(inputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], lossLabelWeightsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], outputsData *foundation.NSDictionary[*foundation.NSString, *MLCTensorData], batchSize uint, options MLCExecutionOptions, completionHandler func(*MLCTensor, unsafe.Pointer, float64)) bool

@abstract Execute the training graph (forward, gradient and optimizer update) with given source and label data @param inputsData The data objects to use for inputs @param lossLabelsData The data objects to use for loss labels @param lossLabelWeightsData The data objects to use for loss label weights @param outputsData The data objects to use for outputs @param batchSize The batch size to use. For a graph where batch size changes between layers this value must be 0. @param options The execution options @param completionHandler The completion handler @return A boolean indicating success or failure

func (*MLCTrainingGraph) GradientDataForParameterLayer

func (o *MLCTrainingGraph) GradientDataForParameterLayer(parameter *MLCTensor, layer *MLCLayer) *foundation.NSData

@abstract Get the gradient data for a trainable parameter associated with a layer @discussion This can be used to get the gradient data for weights or biases parameters associated with a convolution, fully connected or convolution transpose layer @param parameter The updatable parameter associated with the layer @param layer A layer in the training graph. Must be one of the following: - MLCConvolutionLayer - MLCFullyConnectedLayer - MLCBatchNormalizationLayer - MLCInstanceNormalizationLayer - MLCGroupNormalizationLayer - MLCLayerNormalizationLayer - MLCEmbeddingLayer - MLCMultiheadAttentionLayer @return The gradient data. Will return nil if the layer is marked as not trainable or if training graph is not executed with separate calls to forward and gradient passes.

func (*MLCTrainingGraph) GradientTensorForInput

func (o *MLCTrainingGraph) GradientTensorForInput(input *MLCTensor) *MLCTensor

@abstract Get the gradient tensor for an input tensor @param input The input tensor @return The gradient tensor

func (*MLCTrainingGraph) LinkWithGraphs

func (o *MLCTrainingGraph) LinkWithGraphs(graphs *foundation.NSArray[*MLCTrainingGraph]) bool

@abstract Link mutiple training graphs @discussion This is used to link subsequent training graphs with first training sub-graph. This method should be used when we have tensors shared by one or more layers in multiple sub-graphs @param graphs The list of training graphs to link @return A boolean indicating success or failure

func (*MLCTrainingGraph) Optimizer

func (o *MLCTrainingGraph) Optimizer() *MLCOptimizer

@property optimizer @abstract The optimizer to be used with the training graph

func (*MLCTrainingGraph) ResultGradientTensorsForLayer

func (o *MLCTrainingGraph) ResultGradientTensorsForLayer(layer *MLCLayer) *foundation.NSArray[*MLCTensor]

@abstract Get the result gradient tensors for a layer in the training graph @param layer A layer in the training graph @return A list of tensors

func (*MLCTrainingGraph) SetTrainingTensorParameters

func (o *MLCTrainingGraph) SetTrainingTensorParameters(parameters *foundation.NSArray[*MLCTensorParameter]) bool

@abstract Set the input tensor parameters that also will be updated by the optimizer @discussion These represent the list of input tensors to be updated when we execute the optimizer update Weights, bias or beta, gamma tensors are not included in this list. MLCompute automatically adds them to the parameter list based on whether the layer is marked as updatable or not. @param parameters The list of input tensors to be updated by the optimizer @return A boolean indicating success or failure

func (*MLCTrainingGraph) SourceGradientTensorsForLayer

func (o *MLCTrainingGraph) SourceGradientTensorsForLayer(layer *MLCLayer) *foundation.NSArray[*MLCTensor]

@abstract Get the source gradient tensors for a layer in the training graph @param layer A layer in the training graph @return A list of tensors

func (*MLCTrainingGraph) StopGradientForTensors

func (o *MLCTrainingGraph) StopGradientForTensors(tensors *foundation.NSArray[*MLCTensor]) bool

@abstract Add the list of tensors whose contributions are not to be taken when computing gradients during gradient pass @param tensors The list of tensors @return A boolean indicating success or failure

func (*MLCTrainingGraph) SynchronizeUpdates

func (o *MLCTrainingGraph) SynchronizeUpdates()

@abstract Synchronize updates (weights/biases from convolution, fully connected and LSTM layers, tensor parameters) from device memory to host memory.

type MLCTransposeLayer

type MLCTransposeLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlctransposelayer

func MLCTransposeLayerFromID

func MLCTransposeLayerFromID(id objc.ID) *MLCTransposeLayer

func MLCTransposeLayerLayerWithDimensions

func MLCTransposeLayerLayerWithDimensions(dimensions *foundation.NSArray[*foundation.NSNumber]) *MLCTransposeLayer

@abstract Create a transpose layer @param dimensions NSArray<NSNumber *> representing the desired ordering of dimensions The dimensions array specifies the input axis source for each output axis, such that the K'th element in the dimensions array specifies the input axis source for the K'th axis in the output. The batch dimension which is typically axis 0 cannot be transposed. @return A new transpose layer.

func (*MLCTransposeLayer) Dimensions

@property dimensions @abstract Permutes the dimensions according to 'dimensions'. @discussion The returned tensor's dimension i will correspond to dimensions[i].

type MLCUpsampleLayer

type MLCUpsampleLayer struct {
	MLCLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcupsamplelayer

func MLCUpsampleLayerFromID

func MLCUpsampleLayerFromID(id objc.ID) *MLCUpsampleLayer

func MLCUpsampleLayerLayerWithShape

func MLCUpsampleLayerLayerWithShape(shape *foundation.NSArray[*foundation.NSNumber]) *MLCUpsampleLayer

@abstract Create an upsample layer @param shape A NSArray<NSNumber *> representing the dimensions of the result tensor @return A new upsample layer.

func MLCUpsampleLayerLayerWithShapeSampleModeAlignsCorners

func MLCUpsampleLayerLayerWithShapeSampleModeAlignsCorners(shape *foundation.NSArray[*foundation.NSNumber], sampleMode MLCSampleMode, alignsCorners bool) *MLCUpsampleLayer

@abstract Create an upsample layer @param shape A NSArray<NSNumber *> representing the dimensions of the result tensor @param sampleMode The upsampling algorithm to use. Default is nearest. @param alignsCorners Whether the corner pixels of the input and output tensors are aligned or not. @return A new upsample layer.

func (*MLCUpsampleLayer) AlignsCorners

func (o *MLCUpsampleLayer) AlignsCorners() bool

@property alignsCorners @abstract A boolean that specifies whether the corner pixels of the source and result tensors are aligned. @discussion If True, the corner pixels of the source and result tensors are aligned, and thus preserving the values at those pixels. This only has effect when mode is 'bilinear'. Default is NO.

func (*MLCUpsampleLayer) SampleMode

func (o *MLCUpsampleLayer) SampleMode() MLCSampleMode

@property sampleMode @abstract The sampling mode to use when performing the upsample.

func (*MLCUpsampleLayer) Shape

@property shape @abstract A NSArray<NSNumber *> representing just the width if number of entries in shape array is 1 or the height followed by width of result tensor if the number of entries in shape array is 2.

type MLCYOLOLossDescriptor

type MLCYOLOLossDescriptor struct {
	foundation.NSObject
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcyololossdescriptor

func MLCYOLOLossDescriptorDescriptorWithAnchorBoxesAnchorBoxCount

func MLCYOLOLossDescriptorDescriptorWithAnchorBoxesAnchorBoxCount(anchorBoxes *foundation.NSData, anchorBoxCount uint) *MLCYOLOLossDescriptor

@abstract Create a YOLO loss descriptor object @param anchorBoxes The anchor box data @param anchorBoxCount The number of anchor boxes @return A new MLCYOLOLossDescriptor object.

func MLCYOLOLossDescriptorFromID

func MLCYOLOLossDescriptorFromID(id objc.ID) *MLCYOLOLossDescriptor

func (*MLCYOLOLossDescriptor) AnchorBoxCount

func (o *MLCYOLOLossDescriptor) AnchorBoxCount() uint

@property anchorBoxCount @abstract number of anchor boxes used to detect object per grid cell

func (*MLCYOLOLossDescriptor) AnchorBoxes

func (o *MLCYOLOLossDescriptor) AnchorBoxes() *foundation.NSData

@property anchorBoxes @abstract \p NSData containing the width and height for \p anchorBoxCount anchor boxes This \p NSData should have 2 floating-point values per anchor box which represent the width and height of the anchor box.

func (*MLCYOLOLossDescriptor) MaximumIOUForObjectAbsence

func (o *MLCYOLOLossDescriptor) MaximumIOUForObjectAbsence() float32

@property negative IOU @abstract If the prediction IOU with groundTruth is lower than this value we consider it a confident object absence. The default is 0.3

func (*MLCYOLOLossDescriptor) MinimumIOUForObjectPresence

func (o *MLCYOLOLossDescriptor) MinimumIOUForObjectPresence() float32

@property positive IOU @abstract If the prediction IOU with groundTruth is higher than this value we consider it a confident object presence, The default is 0.7

func (*MLCYOLOLossDescriptor) ScaleClassLoss

func (o *MLCYOLOLossDescriptor) ScaleClassLoss() float32

@property scaleClass @abstract The scale factor for no object classes loss and loss gradient. The default is 2.0

func (*MLCYOLOLossDescriptor) ScaleNoObjectConfidenceLoss

func (o *MLCYOLOLossDescriptor) ScaleNoObjectConfidenceLoss() float32

@property scaleNoObject @abstract The scale factor for no object confidence loss and loss gradient. The default is 5.0

func (*MLCYOLOLossDescriptor) ScaleObjectConfidenceLoss

func (o *MLCYOLOLossDescriptor) ScaleObjectConfidenceLoss() float32

@property scaleObject @abstract The scale factor for object confidence loss and loss gradient. The default is 100.0

func (*MLCYOLOLossDescriptor) ScaleSpatialPositionLoss

func (o *MLCYOLOLossDescriptor) ScaleSpatialPositionLoss() float32

@property scaleSpatialPositionLoss @abstract The scale factor for spatial position loss and loss gradient. The default is 10.0

func (*MLCYOLOLossDescriptor) ScaleSpatialSizeLoss

func (o *MLCYOLOLossDescriptor) ScaleSpatialSizeLoss() float32

@property scaleSpatialSizeLoss @abstract The scale factor for spatial size loss and loss gradient. The default is 10.0

func (*MLCYOLOLossDescriptor) SetMaximumIOUForObjectAbsence

func (o *MLCYOLOLossDescriptor) SetMaximumIOUForObjectAbsence(maximumIOUForObjectAbsence float32)

func (*MLCYOLOLossDescriptor) SetMinimumIOUForObjectPresence

func (o *MLCYOLOLossDescriptor) SetMinimumIOUForObjectPresence(minimumIOUForObjectPresence float32)

func (*MLCYOLOLossDescriptor) SetScaleClassLoss

func (o *MLCYOLOLossDescriptor) SetScaleClassLoss(scaleClassLoss float32)

func (*MLCYOLOLossDescriptor) SetScaleNoObjectConfidenceLoss

func (o *MLCYOLOLossDescriptor) SetScaleNoObjectConfidenceLoss(scaleNoObjectConfidenceLoss float32)

func (*MLCYOLOLossDescriptor) SetScaleObjectConfidenceLoss

func (o *MLCYOLOLossDescriptor) SetScaleObjectConfidenceLoss(scaleObjectConfidenceLoss float32)

func (*MLCYOLOLossDescriptor) SetScaleSpatialPositionLoss

func (o *MLCYOLOLossDescriptor) SetScaleSpatialPositionLoss(scaleSpatialPositionLoss float32)

func (*MLCYOLOLossDescriptor) SetScaleSpatialSizeLoss

func (o *MLCYOLOLossDescriptor) SetScaleSpatialSizeLoss(scaleSpatialSizeLoss float32)

func (*MLCYOLOLossDescriptor) SetShouldRescore

func (o *MLCYOLOLossDescriptor) SetShouldRescore(shouldRescore bool)

func (*MLCYOLOLossDescriptor) ShouldRescore

func (o *MLCYOLOLossDescriptor) ShouldRescore() bool

@property shouldRescore @abstract Rescore pertains to multiplying the confidence groundTruth with IOU (intersection over union) of predicted bounding box and the groundTruth boundingBox. The default is YES

type MLCYOLOLossLayer

type MLCYOLOLossLayer struct {
	MLCLossLayer
}

Apple documentation: https://developer.apple.com/documentation/mlcompute/mlcyololosslayer

func MLCYOLOLossLayerFromID

func MLCYOLOLossLayerFromID(id objc.ID) *MLCYOLOLossLayer

func MLCYOLOLossLayerLayerWithDescriptor

func MLCYOLOLossLayerLayerWithDescriptor(lossDescriptor *MLCYOLOLossDescriptor) *MLCYOLOLossLayer

@abstract Create a YOLO loss layer @param lossDescriptor The loss descriptor @return A new YOLO loss layer.

func (*MLCYOLOLossLayer) YoloLossDescriptor

func (o *MLCYOLOLossLayer) YoloLossDescriptor() *MLCYOLOLossDescriptor

@property yoloLossDescriptor @abstract The YOLO loss descriptor

type Mach_vm_range_flags_t

type Mach_vm_range_flags_t int64
const (
	MACH_VM_RANGE_NONE Mach_vm_range_flags_t = 0
)

func (Mach_vm_range_flags_t) String

func (e Mach_vm_range_flags_t) String() string

type Mach_vm_range_flavor_t

type Mach_vm_range_flavor_t int64
const (
	MACH_VM_RANGE_FLAVOR_INVALID Mach_vm_range_flavor_t = 0
	MACH_VM_RANGE_FLAVOR_V1      Mach_vm_range_flavor_t = 1
)

func (Mach_vm_range_flavor_t) String

func (e Mach_vm_range_flavor_t) String() string

type Mach_vm_range_tag_t

type Mach_vm_range_tag_t int64
const (
	MACH_VM_RANGE_DEFAULT Mach_vm_range_tag_t = 0
	MACH_VM_RANGE_DATA    Mach_vm_range_tag_t = 1
	MACH_VM_RANGE_FIXED   Mach_vm_range_tag_t = 2
)

func (Mach_vm_range_tag_t) String

func (e Mach_vm_range_tag_t) String() string

type Mpo_flags_t

type Mpo_flags_t int64
const (
	MPO_PORT                            Mpo_flags_t = 0
	MPO_SERVICE_PORT                    Mpo_flags_t = 1024
	MPO_CONNECTION_PORT                 Mpo_flags_t = 2048
	MPO_REPLY_PORT                      Mpo_flags_t = 4096
	MPO_WEAK_REPLY_PORT                 Mpo_flags_t = 16384
	MPO_NOTIFICATION_PORT               Mpo_flags_t = 17408
	MPO_EXCEPTION_PORT                  Mpo_flags_t = 32768
	MPO_CONNECTION_PORT_WITH_PORT_ARRAY Mpo_flags_t = 65536
)

func (Mpo_flags_t) String

func (e Mpo_flags_t) String() string

type Os_clockid_t

type Os_clockid_t int64
const (
	OS_CLOCK_MACH_ABSOLUTE_TIME Os_clockid_t = 32
)

func (Os_clockid_t) String

func (e Os_clockid_t) String() string

type Ptrauth_key

type Ptrauth_key int64
const (
	Ptrauth_key_none                     Ptrauth_key = -1
	Ptrauth_key_asia                     Ptrauth_key = 0
	Ptrauth_key_asib                     Ptrauth_key = 1
	Ptrauth_key_asda                     Ptrauth_key = 2
	Ptrauth_key_asdb                     Ptrauth_key = 3
	Ptrauth_key_process_independent_code Ptrauth_key = 0
	Ptrauth_key_process_dependent_code   Ptrauth_key = 1
	Ptrauth_key_process_independent_data Ptrauth_key = 2
	Ptrauth_key_process_dependent_data   Ptrauth_key = 3
	Ptrauth_key_return_address           Ptrauth_key = 1
	Ptrauth_key_frame_pointer            Ptrauth_key = 3
	Ptrauth_key_function_pointer         Ptrauth_key = 0
	Ptrauth_key_block_function           Ptrauth_key = 0
	Ptrauth_key_cxx_vtable_pointer       Ptrauth_key = 2
	Ptrauth_key_method_list_pointer      Ptrauth_key = 2
	Ptrauth_key_objc_isa_pointer         Ptrauth_key = 2
	Ptrauth_key_objc_super_pointer       Ptrauth_key = 2
	Ptrauth_key_objc_sel_pointer         Ptrauth_key = 3
	Ptrauth_key_objc_class_ro_pointer    Ptrauth_key = 2
	Ptrauth_key_block_descriptor_pointer Ptrauth_key = 2
	Ptrauth_key_init_fini_pointer        Ptrauth_key = 0
)

func (Ptrauth_key) String

func (e Ptrauth_key) String() string

type Qos_class_t

type Qos_class_t uint32
const (
	QOS_CLASS_USER_INTERACTIVE Qos_class_t = 33
	QOS_CLASS_USER_INITIATED   Qos_class_t = 25
	QOS_CLASS_DEFAULT          Qos_class_t = 21
	QOS_CLASS_UTILITY          Qos_class_t = 17
	QOS_CLASS_BACKGROUND       Qos_class_t = 9
	QOS_CLASS_UNSPECIFIED      Qos_class_t = 0
)

func (Qos_class_t) String

func (e Qos_class_t) String() string

type Virtual_memory_guard_exception_code_t

type Virtual_memory_guard_exception_code_t int64
const (
	KGUARD_EXC_DEALLOC_GAP                   Virtual_memory_guard_exception_code_t = 1
	KGUARD_EXC_RECLAIM_COPYIO_FAILURE        Virtual_memory_guard_exception_code_t = 2
	KGUARD_EXC_RECLAIM_INDEX_FAILURE         Virtual_memory_guard_exception_code_t = 4
	KGUARD_EXC_RECLAIM_DEALLOCATE_FAILURE    Virtual_memory_guard_exception_code_t = 8
	KGUARD_EXC_RECLAIM_ACCOUNTING_FAILURE    Virtual_memory_guard_exception_code_t = 9
	KGUARD_EXC_SEC_IOPL_ON_EXEC_PAGE         Virtual_memory_guard_exception_code_t = 10
	KGUARD_EXC_SEC_EXEC_ON_IOPL_PAGE         Virtual_memory_guard_exception_code_t = 11
	KGUARD_EXC_SEC_UPL_WRITE_ON_EXEC_REGION  Virtual_memory_guard_exception_code_t = 12
	KGUARD_EXC_LARGE_ALLOCATION_TELEMETRY    Virtual_memory_guard_exception_code_t = 13
	KGUARD_EXC_SEC_ACCESS_FAULT              Virtual_memory_guard_exception_code_t = 98
	KGUARD_EXC_SEC_ASYNC_ACCESS_FAULT        Virtual_memory_guard_exception_code_t = 99
	KGUARD_EXC_SEC_COPY_DENIED               Virtual_memory_guard_exception_code_t = 100
	KGUARD_EXC_SEC_SHARING_DENIED            Virtual_memory_guard_exception_code_t = 101
	KGUARD_EXC_MTE_SYNC_FAULT                Virtual_memory_guard_exception_code_t = 200
	KGUARD_EXC_MTE_ASYNC_USER_FAULT          Virtual_memory_guard_exception_code_t = 201
	KGUARD_EXC_MTE_ASYNC_KERN_FAULT          Virtual_memory_guard_exception_code_t = 202
	KGUARD_EXC_GUARD_OBJECT_ASYNC_USER_FAULT Virtual_memory_guard_exception_code_t = 203
	KGUARD_EXC_GUARD_OBJECT_ASYNC_KERN_FAULT Virtual_memory_guard_exception_code_t = 204
)

func (Virtual_memory_guard_exception_code_t) String

type Xpc_listener_create_flags_t

type Xpc_listener_create_flags_t int64
const (
	XPC_LISTENER_CREATE_NONE             Xpc_listener_create_flags_t = 0
	XPC_LISTENER_CREATE_INACTIVE         Xpc_listener_create_flags_t = 1
	XPC_LISTENER_CREATE_FORCE_MACH       Xpc_listener_create_flags_t = 2
	XPC_LISTENER_CREATE_FORCE_XPCSERVICE Xpc_listener_create_flags_t = 4
)

func (Xpc_listener_create_flags_t) String

type Xpc_session_create_flags_t

type Xpc_session_create_flags_t int64
const (
	XPC_SESSION_CREATE_NONE            Xpc_session_create_flags_t = 0
	XPC_SESSION_CREATE_INACTIVE        Xpc_session_create_flags_t = 1
	XPC_SESSION_CREATE_MACH_PRIVILEGED Xpc_session_create_flags_t = 2
)

func (Xpc_session_create_flags_t) String

Jump to

Keyboard shortcuts

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