ホーム › AI.MachineLearning.WinML › MLOperatorKernelDescription
MLOperatorKernelDescription
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| domain | LPSTR | 8/4 | +0 | +0 | カーネルが属する演算子のドメイン名(ASCII文字列)。 |
| name | LPSTR | 8/4 | +8 | +4 | カーネルが実装する演算子の名前(ASCII文字列)。 |
| minimumOperatorSetVersion | INT | 4 | +16 | +8 | このカーネルが対応する最小の演算子セットバージョン。 |
| executionType | MLOperatorExecutionType | 4 | +20 | +12 | カーネルの実行種別(CPUかD3D12か)を示す列挙値。 |
| typeConstraints | MLOperatorEdgeTypeConstraint* | 8/4 | +24 | +16 | 型制約の配列へのポインタ。 |
| typeConstraintCount | DWORD | 4 | +32 | +20 | typeConstraints配列の要素数。 |
| defaultAttributes | MLOperatorAttributeNameValue* | 8/4 | +40 | +24 | 属性の既定値の配列へのポインタ。 |
| defaultAttributeCount | DWORD | 4 | +48 | +28 | defaultAttributes配列の要素数。 |
| options | MLOperatorKernelOptions | 4 | +52 | +32 | カーネルの動作オプションを示すフラグ列挙値。 |
| executionOptions | DWORD | 4 | +56 | +36 | 実行に関する追加オプションを示すビットフラグ。 |
各言語での定義
#include <windows.h>
// MLOperatorKernelDescription (x64 64 / x86 40 バイト)
typedef struct MLOperatorKernelDescription {
LPSTR domain;
LPSTR name;
INT minimumOperatorSetVersion;
MLOperatorExecutionType executionType;
MLOperatorEdgeTypeConstraint* typeConstraints;
DWORD typeConstraintCount;
MLOperatorAttributeNameValue* defaultAttributes;
DWORD defaultAttributeCount;
MLOperatorKernelOptions options;
DWORD executionOptions;
} MLOperatorKernelDescription;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MLOperatorKernelDescription
{
public IntPtr domain;
public IntPtr name;
public int minimumOperatorSetVersion;
public uint executionType;
public IntPtr typeConstraints;
public uint typeConstraintCount;
public IntPtr defaultAttributes;
public uint defaultAttributeCount;
public uint options;
public uint executionOptions;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MLOperatorKernelDescription
Public domain As IntPtr
Public name As IntPtr
Public minimumOperatorSetVersion As Integer
Public executionType As UInteger
Public typeConstraints As IntPtr
Public typeConstraintCount As UInteger
Public defaultAttributes As IntPtr
Public defaultAttributeCount As UInteger
Public options As UInteger
Public executionOptions As UInteger
End Structureimport ctypes
from ctypes import wintypes
class MLOperatorKernelDescription(ctypes.Structure):
_fields_ = [
("domain", ctypes.c_void_p),
("name", ctypes.c_void_p),
("minimumOperatorSetVersion", ctypes.c_int),
("executionType", wintypes.DWORD),
("typeConstraints", ctypes.c_void_p),
("typeConstraintCount", wintypes.DWORD),
("defaultAttributes", ctypes.c_void_p),
("defaultAttributeCount", wintypes.DWORD),
("options", wintypes.DWORD),
("executionOptions", wintypes.DWORD),
]#[repr(C)]
pub struct MLOperatorKernelDescription {
pub domain: *mut core::ffi::c_void,
pub name: *mut core::ffi::c_void,
pub minimumOperatorSetVersion: i32,
pub executionType: u32,
pub typeConstraints: *mut core::ffi::c_void,
pub typeConstraintCount: u32,
pub defaultAttributes: *mut core::ffi::c_void,
pub defaultAttributeCount: u32,
pub options: u32,
pub executionOptions: u32,
}import "golang.org/x/sys/windows"
type MLOperatorKernelDescription struct {
domain uintptr
name uintptr
minimumOperatorSetVersion int32
executionType uint32
typeConstraints uintptr
typeConstraintCount uint32
defaultAttributes uintptr
defaultAttributeCount uint32
options uint32
executionOptions uint32
}type
MLOperatorKernelDescription = record
domain: Pointer;
name: Pointer;
minimumOperatorSetVersion: Integer;
executionType: DWORD;
typeConstraints: Pointer;
typeConstraintCount: DWORD;
defaultAttributes: Pointer;
defaultAttributeCount: DWORD;
options: DWORD;
executionOptions: DWORD;
end;const MLOperatorKernelDescription = extern struct {
domain: ?*anyopaque,
name: ?*anyopaque,
minimumOperatorSetVersion: i32,
executionType: u32,
typeConstraints: ?*anyopaque,
typeConstraintCount: u32,
defaultAttributes: ?*anyopaque,
defaultAttributeCount: u32,
options: u32,
executionOptions: u32,
};type
MLOperatorKernelDescription {.bycopy.} = object
domain: pointer
name: pointer
minimumOperatorSetVersion: int32
executionType: uint32
typeConstraints: pointer
typeConstraintCount: uint32
defaultAttributes: pointer
defaultAttributeCount: uint32
options: uint32
executionOptions: uint32struct MLOperatorKernelDescription
{
void* domain;
void* name;
int minimumOperatorSetVersion;
uint executionType;
void* typeConstraints;
uint typeConstraintCount;
void* defaultAttributes;
uint defaultAttributeCount;
uint options;
uint executionOptions;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MLOperatorKernelDescription サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; domain : LPSTR (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; name : LPSTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; minimumOperatorSetVersion : INT (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; executionType : MLOperatorExecutionType (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; typeConstraints : MLOperatorEdgeTypeConstraint* (+16, 4byte) varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; typeConstraintCount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; defaultAttributes : MLOperatorAttributeNameValue* (+24, 4byte) varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; defaultAttributeCount : DWORD (+28, 4byte) st.7 = 値 / 値 = st.7 (lpoke/lpeek も可)
; options : MLOperatorKernelOptions (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; executionOptions : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MLOperatorKernelDescription サイズ: 64 バイト(x64)
dim st, 16 ; 4byte整数×16(構造体サイズ 64 / 4 切り上げ)
; domain : LPSTR (+0, 8byte) qpoke st,0,値 / qpeek(st,0) ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; name : LPSTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; minimumOperatorSetVersion : INT (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; executionType : MLOperatorExecutionType (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; typeConstraints : MLOperatorEdgeTypeConstraint* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; typeConstraintCount : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; defaultAttributes : MLOperatorAttributeNameValue* (+40, 8byte) varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; defaultAttributeCount : DWORD (+48, 4byte) st.12 = 値 / 値 = st.12 (lpoke/lpeek も可)
; options : MLOperatorKernelOptions (+52, 4byte) st.13 = 値 / 値 = st.13 (lpoke/lpeek も可)
; executionOptions : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MLOperatorKernelDescription
#field intptr domain
#field intptr name
#field int minimumOperatorSetVersion
#field int executionType
#field intptr typeConstraints
#field int typeConstraintCount
#field intptr defaultAttributes
#field int defaultAttributeCount
#field int options
#field int executionOptions
#endstruct
stdim st, MLOperatorKernelDescription ; NSTRUCT 変数を確保
st->minimumOperatorSetVersion = 100
mes "minimumOperatorSetVersion=" + st->minimumOperatorSetVersion