ホーム › AI.MachineLearning.DirectML › DML_UPSAMPLE_2D_OPERATOR_DESC
DML_UPSAMPLE_2D_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へのポインタ。 |
| OutputTensor | DML_TENSOR_DESC* | 8/4 | +8 | +4 | 演算結果を格納する出力テンソルを記述するDML_TENSOR_DESCへのポインタ。 |
| ScaleSize | DML_SIZE_2D | 8 | +16 | +8 | 幅・高さ方向の拡大倍率を指定するDML_SIZE_2D。 |
| InterpolationMode | DML_INTERPOLATION_MODE | 4 | +24 | +16 | リサンプリングの補間方式を指定するDML_INTERPOLATION_MODE値。 |
各言語での定義
#include <windows.h>
// DML_SIZE_2D (x64 8 / x86 8 バイト)
typedef struct DML_SIZE_2D {
DWORD Width;
DWORD Height;
} DML_SIZE_2D;
// DML_UPSAMPLE_2D_OPERATOR_DESC (x64 32 / x86 20 バイト)
typedef struct DML_UPSAMPLE_2D_OPERATOR_DESC {
DML_TENSOR_DESC* InputTensor;
DML_TENSOR_DESC* OutputTensor;
DML_SIZE_2D ScaleSize;
DML_INTERPOLATION_MODE InterpolationMode;
} DML_UPSAMPLE_2D_OPERATOR_DESC;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DML_SIZE_2D
{
public uint Width;
public uint Height;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DML_UPSAMPLE_2D_OPERATOR_DESC
{
public IntPtr InputTensor;
public IntPtr OutputTensor;
public DML_SIZE_2D ScaleSize;
public int InterpolationMode;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DML_SIZE_2D
Public Width As UInteger
Public Height As UInteger
End Structure
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DML_UPSAMPLE_2D_OPERATOR_DESC
Public InputTensor As IntPtr
Public OutputTensor As IntPtr
Public ScaleSize As DML_SIZE_2D
Public InterpolationMode As Integer
End Structureimport ctypes
from ctypes import wintypes
class DML_SIZE_2D(ctypes.Structure):
_fields_ = [
("Width", wintypes.DWORD),
("Height", wintypes.DWORD),
]
class DML_UPSAMPLE_2D_OPERATOR_DESC(ctypes.Structure):
_fields_ = [
("InputTensor", ctypes.c_void_p),
("OutputTensor", ctypes.c_void_p),
("ScaleSize", DML_SIZE_2D),
("InterpolationMode", ctypes.c_int),
]#[repr(C)]
pub struct DML_SIZE_2D {
pub Width: u32,
pub Height: u32,
}
#[repr(C)]
pub struct DML_UPSAMPLE_2D_OPERATOR_DESC {
pub InputTensor: *mut core::ffi::c_void,
pub OutputTensor: *mut core::ffi::c_void,
pub ScaleSize: DML_SIZE_2D,
pub InterpolationMode: i32,
}import "golang.org/x/sys/windows"
type DML_SIZE_2D struct {
Width uint32
Height uint32
}
type DML_UPSAMPLE_2D_OPERATOR_DESC struct {
InputTensor uintptr
OutputTensor uintptr
ScaleSize DML_SIZE_2D
InterpolationMode int32
}type
DML_SIZE_2D = record
Width: DWORD;
Height: DWORD;
end;
DML_UPSAMPLE_2D_OPERATOR_DESC = record
InputTensor: Pointer;
OutputTensor: Pointer;
ScaleSize: DML_SIZE_2D;
InterpolationMode: Integer;
end;const DML_SIZE_2D = extern struct {
Width: u32,
Height: u32,
};
const DML_UPSAMPLE_2D_OPERATOR_DESC = extern struct {
InputTensor: ?*anyopaque,
OutputTensor: ?*anyopaque,
ScaleSize: DML_SIZE_2D,
InterpolationMode: i32,
};type
DML_SIZE_2D {.bycopy.} = object
Width: uint32
Height: uint32
DML_UPSAMPLE_2D_OPERATOR_DESC {.bycopy.} = object
InputTensor: pointer
OutputTensor: pointer
ScaleSize: DML_SIZE_2D
InterpolationMode: int32struct DML_SIZE_2D
{
uint Width;
uint Height;
}
struct DML_UPSAMPLE_2D_OPERATOR_DESC
{
void* InputTensor;
void* OutputTensor;
DML_SIZE_2D ScaleSize;
int InterpolationMode;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DML_UPSAMPLE_2D_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:入れ子/配列)
; ScaleSize : DML_SIZE_2D (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; InterpolationMode : DML_INTERPOLATION_MODE (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DML_UPSAMPLE_2D_OPERATOR_DESC サイズ: 32 バイト(x64)
dim st, 8 ; 4byte整数×8(構造体サイズ 32 / 4 切り上げ)
; InputTensor : DML_TENSOR_DESC* (+0, 8byte) varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; OutputTensor : DML_TENSOR_DESC* (+8, 8byte) varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; ScaleSize : DML_SIZE_2D (+16, 8byte) varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; InterpolationMode : DML_INTERPOLATION_MODE (+24, 4byte) st.6 = 値 / 値 = st.6 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
; ※GUID・入れ子構造体はデフォルト型でないため、依存する #defstruct を先に定義(下記に同梱)。
#defstruct global DML_SIZE_2D
#field int Width
#field int Height
#endstruct
#defstruct global DML_UPSAMPLE_2D_OPERATOR_DESC
#field intptr InputTensor
#field intptr OutputTensor
#field DML_SIZE_2D ScaleSize
#field int InterpolationMode
#endstruct
stdim st, DML_UPSAMPLE_2D_OPERATOR_DESC ; NSTRUCT 変数を確保
st->InterpolationMode = 100
mes "InterpolationMode=" + st->InterpolationMode