Win32 API 日本語リファレンス
ホームAI.MachineLearning.WinML › MLOperatorSchemaDescription

MLOperatorSchemaDescription

構造体
サイズx64: 96 バイト / x86: 48 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
nameLPSTR8/4+0+0演算子スキーマの名前(ASCII文字列)。
operatorSetVersionAtLastChangeINT4+8+4この演算子が最後に変更された演算子セットのバージョン。
inputsMLOperatorSchemaEdgeDescription*8/4+16+8入力エッジのスキーマ記述子配列へのポインタ。
inputCountDWORD4+24+12inputs配列の要素数(入力数)。
outputsMLOperatorSchemaEdgeDescription*8/4+32+16出力エッジのスキーマ記述子配列へのポインタ。
outputCountDWORD4+40+20outputs配列の要素数(出力数)。
typeConstraintsMLOperatorEdgeTypeConstraint*8/4+48+24型制約の配列へのポインタ。
typeConstraintCountDWORD4+56+28typeConstraints配列の要素数。
attributesMLOperatorAttribute*8/4+64+32演算子属性の配列へのポインタ。
attributeCountDWORD4+72+36attributes配列の要素数。
defaultAttributesMLOperatorAttributeNameValue*8/4+80+40属性の既定値の配列へのポインタ。
defaultAttributeCountDWORD4+88+44defaultAttributes配列の要素数。

各言語での定義

#include <windows.h>

// MLOperatorSchemaDescription  (x64 96 / x86 48 バイト)
typedef struct MLOperatorSchemaDescription {
    LPSTR name;
    INT operatorSetVersionAtLastChange;
    MLOperatorSchemaEdgeDescription* inputs;
    DWORD inputCount;
    MLOperatorSchemaEdgeDescription* outputs;
    DWORD outputCount;
    MLOperatorEdgeTypeConstraint* typeConstraints;
    DWORD typeConstraintCount;
    MLOperatorAttribute* attributes;
    DWORD attributeCount;
    MLOperatorAttributeNameValue* defaultAttributes;
    DWORD defaultAttributeCount;
} MLOperatorSchemaDescription;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct MLOperatorSchemaDescription
{
    public IntPtr name;
    public int operatorSetVersionAtLastChange;
    public IntPtr inputs;
    public uint inputCount;
    public IntPtr outputs;
    public uint outputCount;
    public IntPtr typeConstraints;
    public uint typeConstraintCount;
    public IntPtr attributes;
    public uint attributeCount;
    public IntPtr defaultAttributes;
    public uint defaultAttributeCount;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure MLOperatorSchemaDescription
    Public name As IntPtr
    Public operatorSetVersionAtLastChange As Integer
    Public inputs As IntPtr
    Public inputCount As UInteger
    Public outputs As IntPtr
    Public outputCount As UInteger
    Public typeConstraints As IntPtr
    Public typeConstraintCount As UInteger
    Public attributes As IntPtr
    Public attributeCount As UInteger
    Public defaultAttributes As IntPtr
    Public defaultAttributeCount As UInteger
End Structure
import ctypes
from ctypes import wintypes

class MLOperatorSchemaDescription(ctypes.Structure):
    _fields_ = [
        ("name", ctypes.c_void_p),
        ("operatorSetVersionAtLastChange", ctypes.c_int),
        ("inputs", ctypes.c_void_p),
        ("inputCount", wintypes.DWORD),
        ("outputs", ctypes.c_void_p),
        ("outputCount", wintypes.DWORD),
        ("typeConstraints", ctypes.c_void_p),
        ("typeConstraintCount", wintypes.DWORD),
        ("attributes", ctypes.c_void_p),
        ("attributeCount", wintypes.DWORD),
        ("defaultAttributes", ctypes.c_void_p),
        ("defaultAttributeCount", wintypes.DWORD),
    ]
#[repr(C)]
pub struct MLOperatorSchemaDescription {
    pub name: *mut core::ffi::c_void,
    pub operatorSetVersionAtLastChange: i32,
    pub inputs: *mut core::ffi::c_void,
    pub inputCount: u32,
    pub outputs: *mut core::ffi::c_void,
    pub outputCount: u32,
    pub typeConstraints: *mut core::ffi::c_void,
    pub typeConstraintCount: u32,
    pub attributes: *mut core::ffi::c_void,
    pub attributeCount: u32,
    pub defaultAttributes: *mut core::ffi::c_void,
    pub defaultAttributeCount: u32,
}
import "golang.org/x/sys/windows"

type MLOperatorSchemaDescription struct {
	name uintptr
	operatorSetVersionAtLastChange int32
	inputs uintptr
	inputCount uint32
	outputs uintptr
	outputCount uint32
	typeConstraints uintptr
	typeConstraintCount uint32
	attributes uintptr
	attributeCount uint32
	defaultAttributes uintptr
	defaultAttributeCount uint32
}
type
  MLOperatorSchemaDescription = record
    name: Pointer;
    operatorSetVersionAtLastChange: Integer;
    inputs: Pointer;
    inputCount: DWORD;
    outputs: Pointer;
    outputCount: DWORD;
    typeConstraints: Pointer;
    typeConstraintCount: DWORD;
    attributes: Pointer;
    attributeCount: DWORD;
    defaultAttributes: Pointer;
    defaultAttributeCount: DWORD;
  end;
const MLOperatorSchemaDescription = extern struct {
    name: ?*anyopaque,
    operatorSetVersionAtLastChange: i32,
    inputs: ?*anyopaque,
    inputCount: u32,
    outputs: ?*anyopaque,
    outputCount: u32,
    typeConstraints: ?*anyopaque,
    typeConstraintCount: u32,
    attributes: ?*anyopaque,
    attributeCount: u32,
    defaultAttributes: ?*anyopaque,
    defaultAttributeCount: u32,
};
type
  MLOperatorSchemaDescription {.bycopy.} = object
    name: pointer
    operatorSetVersionAtLastChange: int32
    inputs: pointer
    inputCount: uint32
    outputs: pointer
    outputCount: uint32
    typeConstraints: pointer
    typeConstraintCount: uint32
    attributes: pointer
    attributeCount: uint32
    defaultAttributes: pointer
    defaultAttributeCount: uint32
struct MLOperatorSchemaDescription
{
    void* name;
    int operatorSetVersionAtLastChange;
    void* inputs;
    uint inputCount;
    void* outputs;
    uint outputCount;
    void* typeConstraints;
    uint typeConstraintCount;
    void* attributes;
    uint attributeCount;
    void* defaultAttributes;
    uint defaultAttributeCount;
}

HSP用 定義

HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; MLOperatorSchemaDescription サイズ: 48 バイト(x86)
dim st, 12    ; 4byte整数×12(構造体サイズ 48 / 4 切り上げ)
; name : LPSTR (+0, 4byte)  st.0 = 値  /  値 = st.0   (lpoke/lpeek も可)
; operatorSetVersionAtLastChange : INT (+4, 4byte)  st.1 = 値  /  値 = st.1   (lpoke/lpeek も可)
; inputs : MLOperatorSchemaEdgeDescription* (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; inputCount : DWORD (+12, 4byte)  st.3 = 値  /  値 = st.3   (lpoke/lpeek も可)
; outputs : MLOperatorSchemaEdgeDescription* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; outputCount : DWORD (+20, 4byte)  st.5 = 値  /  値 = st.5   (lpoke/lpeek も可)
; typeConstraints : MLOperatorEdgeTypeConstraint* (+24, 4byte)  varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; typeConstraintCount : DWORD (+28, 4byte)  st.7 = 値  /  値 = st.7   (lpoke/lpeek も可)
; attributes : MLOperatorAttribute* (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; attributeCount : DWORD (+36, 4byte)  st.9 = 値  /  値 = st.9   (lpoke/lpeek も可)
; defaultAttributes : MLOperatorAttributeNameValue* (+40, 4byte)  varptr(st)+40 を基点に操作(4byte:入れ子/配列)
; defaultAttributeCount : DWORD (+44, 4byte)  st.11 = 値  /  値 = st.11   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; MLOperatorSchemaDescription サイズ: 96 バイト(x64)
dim st, 24    ; 4byte整数×24(構造体サイズ 96 / 4 切り上げ)
; name : LPSTR (+0, 8byte)  qpoke st,0,値 / qpeek(st,0)  ※IronHSPのみ。3.7/3.8は lpoke st,0,下位 : lpoke st,4,上位
; operatorSetVersionAtLastChange : INT (+8, 4byte)  st.2 = 値  /  値 = st.2   (lpoke/lpeek も可)
; inputs : MLOperatorSchemaEdgeDescription* (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; inputCount : DWORD (+24, 4byte)  st.6 = 値  /  値 = st.6   (lpoke/lpeek も可)
; outputs : MLOperatorSchemaEdgeDescription* (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; outputCount : DWORD (+40, 4byte)  st.10 = 値  /  値 = st.10   (lpoke/lpeek も可)
; typeConstraints : MLOperatorEdgeTypeConstraint* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; typeConstraintCount : DWORD (+56, 4byte)  st.14 = 値  /  値 = st.14   (lpoke/lpeek も可)
; attributes : MLOperatorAttribute* (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; attributeCount : DWORD (+72, 4byte)  st.18 = 値  /  値 = st.18   (lpoke/lpeek も可)
; defaultAttributes : MLOperatorAttributeNameValue* (+80, 8byte)  varptr(st)+80 を基点に操作(8byte:入れ子/配列)
; defaultAttributeCount : DWORD (+88, 4byte)  st.22 = 値  /  値 = st.22   (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global MLOperatorSchemaDescription
    #field intptr name
    #field int operatorSetVersionAtLastChange
    #field intptr inputs
    #field int inputCount
    #field intptr outputs
    #field int outputCount
    #field intptr typeConstraints
    #field int typeConstraintCount
    #field intptr attributes
    #field int attributeCount
    #field intptr defaultAttributes
    #field int defaultAttributeCount
#endstruct

stdim st, MLOperatorSchemaDescription        ; NSTRUCT 変数を確保
st->operatorSetVersionAtLastChange = 100
mes "operatorSetVersionAtLastChange=" + st->operatorSetVersionAtLastChange