ホーム › AI.MachineLearning.DirectML › DML_GRAPH_DESC
DML_GRAPH_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| InputCount | DWORD | 4 | +0 | +0 | グラフ全体の入力の個数。 |
| OutputCount | DWORD | 4 | +4 | +4 | グラフ全体の出力の個数。 |
| NodeCount | DWORD | 4 | +8 | +8 | グラフに含まれるノードの個数。 |
| Nodes | DML_GRAPH_NODE_DESC* | 8/4 | +16 | +12 | グラフを構成するノード記述子の配列へのポインタ。 |
| InputEdgeCount | DWORD | 4 | +24 | +16 | 入力エッジの個数。 |
| InputEdges | DML_GRAPH_EDGE_DESC* | 8/4 | +32 | +20 | 入力エッジ記述子の配列へのポインタ。 |
| OutputEdgeCount | DWORD | 4 | +40 | +24 | 出力エッジの個数。 |
| OutputEdges | DML_GRAPH_EDGE_DESC* | 8/4 | +48 | +28 | 出力エッジ記述子の配列へのポインタ。 |
| IntermediateEdgeCount | DWORD | 4 | +56 | +32 | 中間エッジの個数。 |
| IntermediateEdges | DML_GRAPH_EDGE_DESC* | 8/4 | +64 | +36 | ノード間を結ぶ中間エッジ記述子の配列へのポインタ。 |
各言語での定義
#include <windows.h>
// DML_GRAPH_DESC (x64 72 / x86 40 バイト)
typedef struct DML_GRAPH_DESC {
DWORD InputCount;
DWORD OutputCount;
DWORD NodeCount;
DML_GRAPH_NODE_DESC* Nodes;
DWORD InputEdgeCount;
DML_GRAPH_EDGE_DESC* InputEdges;
DWORD OutputEdgeCount;
DML_GRAPH_EDGE_DESC* OutputEdges;
DWORD IntermediateEdgeCount;
DML_GRAPH_EDGE_DESC* IntermediateEdges;
} DML_GRAPH_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DML_GRAPH_DESC
{
public uint InputCount;
public uint OutputCount;
public uint NodeCount;
public IntPtr Nodes;
public uint InputEdgeCount;
public IntPtr InputEdges;
public uint OutputEdgeCount;
public IntPtr OutputEdges;
public uint IntermediateEdgeCount;
public IntPtr IntermediateEdges;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DML_GRAPH_DESC
Public InputCount As UInteger
Public OutputCount As UInteger
Public NodeCount As UInteger
Public Nodes As IntPtr
Public InputEdgeCount As UInteger
Public InputEdges As IntPtr
Public OutputEdgeCount As UInteger
Public OutputEdges As IntPtr
Public IntermediateEdgeCount As UInteger
Public IntermediateEdges As IntPtr
End Structureimport ctypes
from ctypes import wintypes
class DML_GRAPH_DESC(ctypes.Structure):
_fields_ = [
("InputCount", wintypes.DWORD),
("OutputCount", wintypes.DWORD),
("NodeCount", wintypes.DWORD),
("Nodes", ctypes.c_void_p),
("InputEdgeCount", wintypes.DWORD),
("InputEdges", ctypes.c_void_p),
("OutputEdgeCount", wintypes.DWORD),
("OutputEdges", ctypes.c_void_p),
("IntermediateEdgeCount", wintypes.DWORD),
("IntermediateEdges", ctypes.c_void_p),
]#[repr(C)]
pub struct DML_GRAPH_DESC {
pub InputCount: u32,
pub OutputCount: u32,
pub NodeCount: u32,
pub Nodes: *mut core::ffi::c_void,
pub InputEdgeCount: u32,
pub InputEdges: *mut core::ffi::c_void,
pub OutputEdgeCount: u32,
pub OutputEdges: *mut core::ffi::c_void,
pub IntermediateEdgeCount: u32,
pub IntermediateEdges: *mut core::ffi::c_void,
}import "golang.org/x/sys/windows"
type DML_GRAPH_DESC struct {
InputCount uint32
OutputCount uint32
NodeCount uint32
Nodes uintptr
InputEdgeCount uint32
InputEdges uintptr
OutputEdgeCount uint32
OutputEdges uintptr
IntermediateEdgeCount uint32
IntermediateEdges uintptr
}type
DML_GRAPH_DESC = record
InputCount: DWORD;
OutputCount: DWORD;
NodeCount: DWORD;
Nodes: Pointer;
InputEdgeCount: DWORD;
InputEdges: Pointer;
OutputEdgeCount: DWORD;
OutputEdges: Pointer;
IntermediateEdgeCount: DWORD;
IntermediateEdges: Pointer;
end;const DML_GRAPH_DESC = extern struct {
InputCount: u32,
OutputCount: u32,
NodeCount: u32,
Nodes: ?*anyopaque,
InputEdgeCount: u32,
InputEdges: ?*anyopaque,
OutputEdgeCount: u32,
OutputEdges: ?*anyopaque,
IntermediateEdgeCount: u32,
IntermediateEdges: ?*anyopaque,
};type
DML_GRAPH_DESC {.bycopy.} = object
InputCount: uint32
OutputCount: uint32
NodeCount: uint32
Nodes: pointer
InputEdgeCount: uint32
InputEdges: pointer
OutputEdgeCount: uint32
OutputEdges: pointer
IntermediateEdgeCount: uint32
IntermediateEdges: pointerstruct DML_GRAPH_DESC
{
uint InputCount;
uint OutputCount;
uint NodeCount;
void* Nodes;
uint InputEdgeCount;
void* InputEdges;
uint OutputEdgeCount;
void* OutputEdges;
uint IntermediateEdgeCount;
void* IntermediateEdges;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DML_GRAPH_DESC サイズ: 40 バイト(x86)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; InputCount : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; OutputCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; NodeCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Nodes : DML_GRAPH_NODE_DESC* (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; InputEdgeCount : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; InputEdges : DML_GRAPH_EDGE_DESC* (+20, 4byte) varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; OutputEdgeCount : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; OutputEdges : DML_GRAPH_EDGE_DESC* (+28, 4byte) varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; IntermediateEdgeCount : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; IntermediateEdges : DML_GRAPH_EDGE_DESC* (+36, 4byte) varptr(st)+36 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DML_GRAPH_DESC サイズ: 72 バイト(x64)
dim st, 18 ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; InputCount : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; OutputCount : DWORD (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; NodeCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Nodes : DML_GRAPH_NODE_DESC* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; InputEdgeCount : DWORD (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; InputEdges : DML_GRAPH_EDGE_DESC* (+32, 8byte) varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; OutputEdgeCount : DWORD (+40, 4byte) st.10 = 値 / 値 = st.10 (lpoke/lpeek も可)
; OutputEdges : DML_GRAPH_EDGE_DESC* (+48, 8byte) varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; IntermediateEdgeCount : DWORD (+56, 4byte) st.14 = 値 / 値 = st.14 (lpoke/lpeek も可)
; IntermediateEdges : DML_GRAPH_EDGE_DESC* (+64, 8byte) varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DML_GRAPH_DESC
#field int InputCount
#field int OutputCount
#field int NodeCount
#field intptr Nodes
#field int InputEdgeCount
#field intptr InputEdges
#field int OutputEdgeCount
#field intptr OutputEdges
#field int IntermediateEdgeCount
#field intptr IntermediateEdges
#endstruct
stdim st, DML_GRAPH_DESC ; NSTRUCT 変数を確保
st->InputCount = 100
mes "InputCount=" + st->InputCount