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

DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC

構造体
サイズx64: 72 バイト / x86: 36 バイト

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

フィールド

フィールドサイズx64x86説明
ATensorDML_TENSOR_DESC*8/4+0+0二項演算の第1オペランド(A)となる入力テンソルを記述するDML_TENSOR_DESCへのポインタ。
AScaleTensorDML_TENSOR_DESC*8/4+8+4行列Aの量子化スケールを保持するテンソルを記述するDML_TENSOR_DESCへのポインタ。
AZeroPointTensorDML_TENSOR_DESC*8/4+16+8行列Aの量子化ゼロ点を保持するテンソルを記述するDML_TENSOR_DESCへのポインタ。省略可。
BTensorDML_TENSOR_DESC*8/4+24+12二項演算の第2オペランド(B)となる入力テンソルを記述するDML_TENSOR_DESCへのポインタ。
BScaleTensorDML_TENSOR_DESC*8/4+32+16行列Bの量子化スケールを保持するテンソルを記述するDML_TENSOR_DESCへのポインタ。
BZeroPointTensorDML_TENSOR_DESC*8/4+40+20行列Bの量子化ゼロ点を保持するテンソルを記述するDML_TENSOR_DESCへのポインタ。省略可。
OutputScaleTensorDML_TENSOR_DESC*8/4+48+24出力の再量子化スケールを保持するテンソルを記述するDML_TENSOR_DESCへのポインタ。
OutputZeroPointTensorDML_TENSOR_DESC*8/4+56+28出力の量子化ゼロ点を保持するテンソルを記述するDML_TENSOR_DESCへのポインタ。省略可。
OutputTensorDML_TENSOR_DESC*8/4+64+32演算結果を格納する出力テンソルを記述するDML_TENSOR_DESCへのポインタ。

各言語での定義

#include <windows.h>

// DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC  (x64 72 / x86 36 バイト)
typedef struct DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC {
    DML_TENSOR_DESC* ATensor;
    DML_TENSOR_DESC* AScaleTensor;
    DML_TENSOR_DESC* AZeroPointTensor;
    DML_TENSOR_DESC* BTensor;
    DML_TENSOR_DESC* BScaleTensor;
    DML_TENSOR_DESC* BZeroPointTensor;
    DML_TENSOR_DESC* OutputScaleTensor;
    DML_TENSOR_DESC* OutputZeroPointTensor;
    DML_TENSOR_DESC* OutputTensor;
} DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC;
using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC
{
    public IntPtr ATensor;
    public IntPtr AScaleTensor;
    public IntPtr AZeroPointTensor;
    public IntPtr BTensor;
    public IntPtr BScaleTensor;
    public IntPtr BZeroPointTensor;
    public IntPtr OutputScaleTensor;
    public IntPtr OutputZeroPointTensor;
    public IntPtr OutputTensor;
}
Imports System.Runtime.InteropServices

<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC
    Public ATensor As IntPtr
    Public AScaleTensor As IntPtr
    Public AZeroPointTensor As IntPtr
    Public BTensor As IntPtr
    Public BScaleTensor As IntPtr
    Public BZeroPointTensor As IntPtr
    Public OutputScaleTensor As IntPtr
    Public OutputZeroPointTensor As IntPtr
    Public OutputTensor As IntPtr
End Structure
import ctypes
from ctypes import wintypes

class DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC(ctypes.Structure):
    _fields_ = [
        ("ATensor", ctypes.c_void_p),
        ("AScaleTensor", ctypes.c_void_p),
        ("AZeroPointTensor", ctypes.c_void_p),
        ("BTensor", ctypes.c_void_p),
        ("BScaleTensor", ctypes.c_void_p),
        ("BZeroPointTensor", ctypes.c_void_p),
        ("OutputScaleTensor", ctypes.c_void_p),
        ("OutputZeroPointTensor", ctypes.c_void_p),
        ("OutputTensor", ctypes.c_void_p),
    ]
#[repr(C)]
pub struct DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC {
    pub ATensor: *mut core::ffi::c_void,
    pub AScaleTensor: *mut core::ffi::c_void,
    pub AZeroPointTensor: *mut core::ffi::c_void,
    pub BTensor: *mut core::ffi::c_void,
    pub BScaleTensor: *mut core::ffi::c_void,
    pub BZeroPointTensor: *mut core::ffi::c_void,
    pub OutputScaleTensor: *mut core::ffi::c_void,
    pub OutputZeroPointTensor: *mut core::ffi::c_void,
    pub OutputTensor: *mut core::ffi::c_void,
}
import "golang.org/x/sys/windows"

type DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC struct {
	ATensor uintptr
	AScaleTensor uintptr
	AZeroPointTensor uintptr
	BTensor uintptr
	BScaleTensor uintptr
	BZeroPointTensor uintptr
	OutputScaleTensor uintptr
	OutputZeroPointTensor uintptr
	OutputTensor uintptr
}
type
  DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC = record
    ATensor: Pointer;
    AScaleTensor: Pointer;
    AZeroPointTensor: Pointer;
    BTensor: Pointer;
    BScaleTensor: Pointer;
    BZeroPointTensor: Pointer;
    OutputScaleTensor: Pointer;
    OutputZeroPointTensor: Pointer;
    OutputTensor: Pointer;
  end;
const DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC = extern struct {
    ATensor: ?*anyopaque,
    AScaleTensor: ?*anyopaque,
    AZeroPointTensor: ?*anyopaque,
    BTensor: ?*anyopaque,
    BScaleTensor: ?*anyopaque,
    BZeroPointTensor: ?*anyopaque,
    OutputScaleTensor: ?*anyopaque,
    OutputZeroPointTensor: ?*anyopaque,
    OutputTensor: ?*anyopaque,
};
type
  DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC {.bycopy.} = object
    ATensor: pointer
    AScaleTensor: pointer
    AZeroPointTensor: pointer
    BTensor: pointer
    BScaleTensor: pointer
    BZeroPointTensor: pointer
    OutputScaleTensor: pointer
    OutputZeroPointTensor: pointer
    OutputTensor: pointer
struct DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC
{
    void* ATensor;
    void* AScaleTensor;
    void* AZeroPointTensor;
    void* BTensor;
    void* BScaleTensor;
    void* BZeroPointTensor;
    void* OutputScaleTensor;
    void* OutputZeroPointTensor;
    void* OutputTensor;
}

HSP用 定義

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

; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC サイズ: 36 バイト(x86)
dim st, 9    ; 4byte整数×9(構造体サイズ 36 / 4 切り上げ)
; ATensor : DML_TENSOR_DESC* (+0, 4byte)  varptr(st)+0 を基点に操作(4byte:入れ子/配列)
; AScaleTensor : DML_TENSOR_DESC* (+4, 4byte)  varptr(st)+4 を基点に操作(4byte:入れ子/配列)
; AZeroPointTensor : DML_TENSOR_DESC* (+8, 4byte)  varptr(st)+8 を基点に操作(4byte:入れ子/配列)
; BTensor : DML_TENSOR_DESC* (+12, 4byte)  varptr(st)+12 を基点に操作(4byte:入れ子/配列)
; BScaleTensor : DML_TENSOR_DESC* (+16, 4byte)  varptr(st)+16 を基点に操作(4byte:入れ子/配列)
; BZeroPointTensor : DML_TENSOR_DESC* (+20, 4byte)  varptr(st)+20 を基点に操作(4byte:入れ子/配列)
; OutputScaleTensor : DML_TENSOR_DESC* (+24, 4byte)  varptr(st)+24 を基点に操作(4byte:入れ子/配列)
; OutputZeroPointTensor : DML_TENSOR_DESC* (+28, 4byte)  varptr(st)+28 を基点に操作(4byte:入れ子/配列)
; OutputTensor : DML_TENSOR_DESC* (+32, 4byte)  varptr(st)+32 を基点に操作(4byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC サイズ: 72 バイト(x64)
dim st, 18    ; 4byte整数×18(構造体サイズ 72 / 4 切り上げ)
; ATensor : DML_TENSOR_DESC* (+0, 8byte)  varptr(st)+0 を基点に操作(8byte:入れ子/配列)
; AScaleTensor : DML_TENSOR_DESC* (+8, 8byte)  varptr(st)+8 を基点に操作(8byte:入れ子/配列)
; AZeroPointTensor : DML_TENSOR_DESC* (+16, 8byte)  varptr(st)+16 を基点に操作(8byte:入れ子/配列)
; BTensor : DML_TENSOR_DESC* (+24, 8byte)  varptr(st)+24 を基点に操作(8byte:入れ子/配列)
; BScaleTensor : DML_TENSOR_DESC* (+32, 8byte)  varptr(st)+32 を基点に操作(8byte:入れ子/配列)
; BZeroPointTensor : DML_TENSOR_DESC* (+40, 8byte)  varptr(st)+40 を基点に操作(8byte:入れ子/配列)
; OutputScaleTensor : DML_TENSOR_DESC* (+48, 8byte)  varptr(st)+48 を基点に操作(8byte:入れ子/配列)
; OutputZeroPointTensor : DML_TENSOR_DESC* (+56, 8byte)  varptr(st)+56 を基点に操作(8byte:入れ子/配列)
; OutputTensor : DML_TENSOR_DESC* (+64, 8byte)  varptr(st)+64 を基点に操作(8byte:入れ子/配列)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。
; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC
    #field intptr ATensor
    #field intptr AScaleTensor
    #field intptr AZeroPointTensor
    #field intptr BTensor
    #field intptr BScaleTensor
    #field intptr BZeroPointTensor
    #field intptr OutputScaleTensor
    #field intptr OutputZeroPointTensor
    #field intptr OutputTensor
#endstruct

stdim st, DML_QUANTIZED_LINEAR_MATRIX_MULTIPLY_OPERATOR_DESC        ; NSTRUCT 変数を確保