ホーム › AI.MachineLearning.DirectML › DML_SCATTER_ND_OPERATOR_DESC
DML_SCATTER_ND_OPERATOR_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| InputTensor | DML_TENSOR_DESC* | 8/4 | +0 | +0 | 演算子の入力テンソルを記述するDML_TENSOR_DESCへのポインタ。 |
| IndicesTensor | DML_TENSOR_DESC* | 8/4 | +8 | +4 | 参照するインデックス値を保持する整数テンソルを記述するDML_TENSOR_DESCへのポインタ。 |
| UpdatesTensor | DML_TENSOR_DESC* | 8/4 | +16 | +8 | 出力へ書き込む更新値を保持するテンソルを記述するDML_TENSOR_DESCへのポインタ。 |
| OutputTensor | DML_TENSOR_DESC* | 8/4 | +24 | +12 | 演算結果を格納する出力テンソルを記述するDML_TENSOR_DESCへのポインタ。 |
| InputDimensionCount | DWORD | 4 | +32 | +16 | 入力テンソルの次元数。 |
| IndicesDimensionCount | DWORD | 4 | +36 | +20 | インデックステンソルの次元数。 |
各言語での定義
#include <windows.h>
// DML_SCATTER_ND_OPERATOR_DESC (x64 40 / x86 24 バイト)
typedef struct DML_SCATTER_ND_OPERATOR_DESC {
DML_TENSOR_DESC* InputTensor;
DML_TENSOR_DESC* IndicesTensor;
DML_TENSOR_DESC* UpdatesTensor;
DML_TENSOR_DESC* OutputTensor;
DWORD InputDimensionCount;
DWORD IndicesDimensionCount;
} DML_SCATTER_ND_OPERATOR_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DML_SCATTER_ND_OPERATOR_DESC
{
public IntPtr InputTensor;
public IntPtr IndicesTensor;
public IntPtr UpdatesTensor;
public IntPtr OutputTensor;
public uint InputDimensionCount;
public uint IndicesDimensionCount;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DML_SCATTER_ND_OPERATOR_DESC
Public InputTensor As IntPtr
Public IndicesTensor As IntPtr
Public UpdatesTensor As IntPtr
Public OutputTensor As IntPtr
Public InputDimensionCount As UInteger
Public IndicesDimensionCount As UInteger
End Structureimport ctypes
from ctypes import wintypes
class DML_SCATTER_ND_OPERATOR_DESC(ctypes.Structure):
_fields_ = [
("InputTensor", ctypes.c_void_p),
("IndicesTensor", ctypes.c_void_p),
("UpdatesTensor", ctypes.c_void_p),
("OutputTensor", ctypes.c_void_p),
("InputDimensionCount", wintypes.DWORD),
("IndicesDimensionCount", wintypes.DWORD),
]#[repr(C)]
pub struct DML_SCATTER_ND_OPERATOR_DESC {
pub InputTensor: *mut core::ffi::c_void,
pub IndicesTensor: *mut core::ffi::c_void,
pub UpdatesTensor: *mut core::ffi::c_void,
pub OutputTensor: *mut core::ffi::c_void,
pub InputDimensionCount: u32,
pub IndicesDimensionCount: u32,
}import "golang.org/x/sys/windows"
type DML_SCATTER_ND_OPERATOR_DESC struct {
InputTensor uintptr
IndicesTensor uintptr
UpdatesTensor uintptr
OutputTensor uintptr
InputDimensionCount uint32
IndicesDimensionCount uint32
}type
DML_SCATTER_ND_OPERATOR_DESC = record
InputTensor: Pointer;
IndicesTensor: Pointer;
UpdatesTensor: Pointer;
OutputTensor: Pointer;
InputDimensionCount: DWORD;
IndicesDimensionCount: DWORD;
end;const DML_SCATTER_ND_OPERATOR_DESC = extern struct {
InputTensor: ?*anyopaque,
IndicesTensor: ?*anyopaque,
UpdatesTensor: ?*anyopaque,
OutputTensor: ?*anyopaque,
InputDimensionCount: u32,
IndicesDimensionCount: u32,
};type
DML_SCATTER_ND_OPERATOR_DESC {.bycopy.} = object
InputTensor: pointer
IndicesTensor: pointer
UpdatesTensor: pointer
OutputTensor: pointer
InputDimensionCount: uint32
IndicesDimensionCount: uint32struct DML_SCATTER_ND_OPERATOR_DESC
{
void* InputTensor;
void* IndicesTensor;
void* UpdatesTensor;
void* OutputTensor;
uint InputDimensionCount;
uint IndicesDimensionCount;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DML_SCATTER_ND_OPERATOR_DESC サイズ: 24 バイト(x86)
dim st, 6 ; 4byte整数×6(構造体サイズ 24 / 4 切り上げ)
; InputTensor : DML_TENSOR_DESC* (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; IndicesTensor : DML_TENSOR_DESC* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; UpdatesTensor : DML_TENSOR_DESC* (+8, 4byte) varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; OutputTensor : DML_TENSOR_DESC* (+12, 4byte) varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; InputDimensionCount : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; IndicesDimensionCount : DWORD (+20, 4byte) st.5 = 値 / 値 = st.5 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DML_SCATTER_ND_OPERATOR_DESC サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; InputTensor : DML_TENSOR_DESC* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; IndicesTensor : DML_TENSOR_DESC* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; UpdatesTensor : DML_TENSOR_DESC* (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; OutputTensor : DML_TENSOR_DESC* (+24, 8byte) varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; InputDimensionCount : DWORD (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; IndicesDimensionCount : DWORD (+36, 4byte) st.9 = 値 / 値 = st.9 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DML_SCATTER_ND_OPERATOR_DESC
#field intptr InputTensor
#field intptr IndicesTensor
#field intptr UpdatesTensor
#field intptr OutputTensor
#field int InputDimensionCount
#field int IndicesDimensionCount
#endstruct
stdim st, DML_SCATTER_ND_OPERATOR_DESC ; NSTRUCT 変数を確保
st->InputDimensionCount = 100
mes "InputDimensionCount=" + st->InputDimensionCount