ホーム › AI.MachineLearning.DirectML › DML_ARGMAX_OPERATOR_DESC
DML_ARGMAX_OPERATOR_DESC
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| InputTensor | DML_TENSOR_DESC* | 8/4 | +0 | +0 | 最大値の位置を求める対象の入力テンソルへのポインタ。 |
| OutputTensor | DML_TENSOR_DESC* | 8/4 | +8 | +4 | 各軸方向で最大値を取るインデックスを格納する出力テンソルへのポインタ。 |
| AxisCount | DWORD | 4 | +16 | +8 | 縮約対象とする軸の数。Axes配列の要素数を示す。 |
| Axes | DWORD* | 8/4 | +24 | +12 | 最大値探索を行う軸のインデックスを並べた配列へのポインタ。要素数はAxisCount。 |
| AxisDirection | DML_AXIS_DIRECTION | 4 | +32 | +16 | 同値時に先頭側と末尾側どちらのインデックスを採るかを指定する方向の列挙値。 |
各言語での定義
#include <windows.h>
// DML_ARGMAX_OPERATOR_DESC (x64 40 / x86 20 バイト)
typedef struct DML_ARGMAX_OPERATOR_DESC {
DML_TENSOR_DESC* InputTensor;
DML_TENSOR_DESC* OutputTensor;
DWORD AxisCount;
DWORD* Axes;
DML_AXIS_DIRECTION AxisDirection;
} DML_ARGMAX_OPERATOR_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DML_ARGMAX_OPERATOR_DESC
{
public IntPtr InputTensor;
public IntPtr OutputTensor;
public uint AxisCount;
public IntPtr Axes;
public int AxisDirection;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DML_ARGMAX_OPERATOR_DESC
Public InputTensor As IntPtr
Public OutputTensor As IntPtr
Public AxisCount As UInteger
Public Axes As IntPtr
Public AxisDirection As Integer
End Structureimport ctypes
from ctypes import wintypes
class DML_ARGMAX_OPERATOR_DESC(ctypes.Structure):
_fields_ = [
("InputTensor", ctypes.c_void_p),
("OutputTensor", ctypes.c_void_p),
("AxisCount", wintypes.DWORD),
("Axes", ctypes.c_void_p),
("AxisDirection", ctypes.c_int),
]#[repr(C)]
pub struct DML_ARGMAX_OPERATOR_DESC {
pub InputTensor: *mut core::ffi::c_void,
pub OutputTensor: *mut core::ffi::c_void,
pub AxisCount: u32,
pub Axes: *mut core::ffi::c_void,
pub AxisDirection: i32,
}import "golang.org/x/sys/windows"
type DML_ARGMAX_OPERATOR_DESC struct {
InputTensor uintptr
OutputTensor uintptr
AxisCount uint32
Axes uintptr
AxisDirection int32
}type
DML_ARGMAX_OPERATOR_DESC = record
InputTensor: Pointer;
OutputTensor: Pointer;
AxisCount: DWORD;
Axes: Pointer;
AxisDirection: Integer;
end;const DML_ARGMAX_OPERATOR_DESC = extern struct {
InputTensor: ?*anyopaque,
OutputTensor: ?*anyopaque,
AxisCount: u32,
Axes: ?*anyopaque,
AxisDirection: i32,
};type
DML_ARGMAX_OPERATOR_DESC {.bycopy.} = object
InputTensor: pointer
OutputTensor: pointer
AxisCount: uint32
Axes: pointer
AxisDirection: int32struct DML_ARGMAX_OPERATOR_DESC
{
void* InputTensor;
void* OutputTensor;
uint AxisCount;
void* Axes;
int AxisDirection;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DML_ARGMAX_OPERATOR_DESC サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; InputTensor : DML_TENSOR_DESC* (+0, 4byte) varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; OutputTensor : DML_TENSOR_DESC* (+4, 4byte) varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; AxisCount : DWORD (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; Axes : DWORD* (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; AxisDirection : DML_AXIS_DIRECTION (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DML_ARGMAX_OPERATOR_DESC サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; InputTensor : DML_TENSOR_DESC* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; OutputTensor : DML_TENSOR_DESC* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; AxisCount : DWORD (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; Axes : DWORD* (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; AxisDirection : DML_AXIS_DIRECTION (+32, 4byte) st.8 = 値 / 値 = st.8 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DML_ARGMAX_OPERATOR_DESC
#field intptr InputTensor
#field intptr OutputTensor
#field int AxisCount
#field intptr Axes
#field int AxisDirection
#endstruct
stdim st, DML_ARGMAX_OPERATOR_DESC ; NSTRUCT 変数を確保
st->AxisCount = 100
mes "AxisCount=" + st->AxisCount