create_dl_layer_denseT_create_dl_layer_denseCreateDlLayerDenseCreateDlLayerDensecreate_dl_layer_dense创建深度学习层稠密(算子)

名称

create_dl_layer_denseT_create_dl_layer_denseCreateDlLayerDenseCreateDlLayerDensecreate_dl_layer_dense — 创建稠密层。

签名

create_dl_layer_dense( : : DLLayerInput, LayerName, NumOut, GenParamName, GenParamValue : DLLayerDense)

Herror T_create_dl_layer_dense(const Htuple DLLayerInput, const Htuple LayerName, const Htuple NumOut, const Htuple GenParamName, const Htuple GenParamValue, Htuple* DLLayerDense)

void CreateDlLayerDense(const HTuple& DLLayerInput, const HTuple& LayerName, const HTuple& NumOut, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* DLLayerDense)

HDlLayer HDlLayer::CreateDlLayerDense(const HString& LayerName, Hlong NumOut, const HTuple& GenParamName, const HTuple& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerDense(const HString& LayerName, Hlong NumOut, const HString& GenParamName, const HString& GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerDense(const char* LayerName, Hlong NumOut, const char* GenParamName, const char* GenParamValue) const

HDlLayer HDlLayer::CreateDlLayerDense(const wchar_t* LayerName, Hlong NumOut, const wchar_t* GenParamName, const wchar_t* GenParamValue) const   ( Windows only)

static void HOperatorSet.CreateDlLayerDense(HTuple DLLayerInput, HTuple layerName, HTuple numOut, HTuple genParamName, HTuple genParamValue, out HTuple DLLayerDense)

HDlLayer HDlLayer.CreateDlLayerDense(string layerName, int numOut, HTuple genParamName, HTuple genParamValue)

HDlLayer HDlLayer.CreateDlLayerDense(string layerName, int numOut, string genParamName, string genParamValue)

def create_dl_layer_dense(dllayer_input: HHandle, layer_name: str, num_out: int, gen_param_name: MaybeSequence[str], gen_param_value: MaybeSequence[Union[int, float, str]]) -> HHandle

描述

算子 create_dl_layer_densecreate_dl_layer_denseCreateDlLayerDenseCreateDlLayerDenseCreateDlLayerDensecreate_dl_layer_dense 创建一个具有 NumOutNumOutNumOutNumOutnumOutnum_out 个输出神经元的稠密层(有时也称为 gemm),其句柄通过 DLLayerDenseDLLayerDenseDLLayerDenseDLLayerDenseDLLayerDensedllayer_dense 返回。

参数 DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input 确定输入层,并期望该层句柄作为值。

参数 LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name 用于设置单个层的名称。请注意,若使用 create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelCreateDlModelcreate_dl_model 创建模型,则创建网络中的每个层必须具有唯一名称。

以下泛型参数 GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name 及其对应值 GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value 受支持:

'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler""bias_filler"

有关此参数及其取值的详细说明,请参阅 create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution

值列表: 'xavier'"xavier""xavier""xavier""xavier""xavier", 'msra'"msra""msra""msra""msra""msra", 'const'"const""const""const""const""const"

默认值: 'const'"const""const""const""const""const"

'bias_filler_const_val'"bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val"

'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler""bias_filler" = 'const'"const""const""const""const""const" 时,取常量值。

默认值: 0

'bias_filler_variance_norm'"bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm"

有关此参数及其取值的详细说明,请参阅 create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution

值列表: 'norm_out'"norm_out""norm_out""norm_out""norm_out""norm_out", 'norm_in'"norm_in""norm_in""norm_in""norm_in""norm_in", 'norm_average'"norm_average""norm_average""norm_average""norm_average""norm_average" 或常量值(需与 'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler""bias_filler" = 'msra'"msra""msra""msra""msra""msra" 组合使用)。

默认值: 'norm_out'"norm_out""norm_out""norm_out""norm_out""norm_out"

'bias_term'"bias_term""bias_term""bias_term""bias_term""bias_term"

确定创建的稠密层是否包含偏置项('true'"true""true""true""true""true")或不包含偏置项('false'"false""false""false""false""false")。

默认值: 'true'"true""true""true""true""true"

'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output"

确定 apply_dl_modelapply_dl_modelApplyDlModelApplyDlModelApplyDlModelapply_dl_model 是否将此层的输出包含在字典 DLResultBatchDLResultBatchDLResultBatchDLResultBatchDLResultBatchdlresult_batch 中,即使未在 OutputsOutputsOutputsOutputsoutputsoutputs 中指定此层('true'"true""true""true""true""true")或不包含('false'"false""false""false""false""false")。

默认值: 'false'"false""false""false""false""false"

'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier"

训练期间用于该层的学习率乘数。若将 'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier" 设为 0.0,则训练时将跳过该层。

默认值: 1.0

'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias"

偏置项的学习率乘数。偏置项的总学习率是 'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias"'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier" 的乘积。

默认值: 1.0

'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler""weight_filler"

有关此参数及其取值的详细说明,请参阅 create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution

值列表: 'xavier'"xavier""xavier""xavier""xavier""xavier", 'msra'"msra""msra""msra""msra""msra", 'const'"const""const""const""const""const"

默认值: 'xavier'"xavier""xavier""xavier""xavier""xavier"

'weight_filler_const_val'"weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val"

有关此参数及其取值的详细说明,请参阅 create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution

默认值: 0.5

'weight_filler_variance_norm'"weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm"

有关此参数及其取值的详细说明,请参阅 create_dl_layer_convolutioncreate_dl_layer_convolutionCreateDlLayerConvolutionCreateDlLayerConvolutionCreateDlLayerConvolutioncreate_dl_layer_convolution

值列表: 'norm_in'"norm_in""norm_in""norm_in""norm_in""norm_in", 'norm_out'"norm_out""norm_out""norm_out""norm_out""norm_out", 'norm_average'"norm_average""norm_average""norm_average""norm_average""norm_average" 或常量值(需与 'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler""bias_filler" = 'msra'"msra""msra""msra""msra""msra" 组合使用)。

默认值: 'norm_in'"norm_in""norm_in""norm_in""norm_in""norm_in"

使用 create_dl_layer_densecreate_dl_layer_denseCreateDlLayerDenseCreateDlLayerDenseCreateDlLayerDensecreate_dl_layer_dense 算子创建的层,其特定参数可通过其他算子进行设置与检索。下表概述了可通过 set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_param 设置的参数,以及可通过 get_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_paramget_dl_layer_paramget_dl_layer_paramGetDlLayerParamGetDlLayerParamGetDlLayerParamget_dl_layer_param 检索的参数。请注意,算子 set_dl_model_layer_paramset_dl_model_layer_paramSetDlModelLayerParamSetDlModelLayerParamSetDlModelLayerParamset_dl_model_layer_paramget_dl_model_layer_paramget_dl_model_layer_paramGetDlModelLayerParamGetDlModelLayerParamGetDlModelLayerParamget_dl_model_layer_param 需基于 create_dl_modelcreate_dl_modelCreateDlModelCreateDlModelCreateDlModelcreate_dl_model 创建的模型。

层参数 设置 获取
'input_layer'"input_layer""input_layer""input_layer""input_layer""input_layer" (DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input)
'name'"name""name""name""name""name" (LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name)
'neurons_in'"neurons_in""neurons_in""neurons_in""neurons_in""neurons_in"
'neurons_out'"neurons_out""neurons_out""neurons_out""neurons_out""neurons_out" (NumOutNumOutNumOutNumOutnumOutnum_out)
'output_layer'"output_layer""output_layer""output_layer""output_layer""output_layer" (DLLayerDenseDLLayerDenseDLLayerDenseDLLayerDenseDLLayerDensedllayer_dense)
'shape'"shape""shape""shape""shape""shape"
'type'"type""type""type""type""type"
泛型层参数 设置 获取
'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler""bias_filler"
'bias_filler_const_val'"bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val"
'bias_filler_variance_norm'"bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm"
'bias_term'"bias_term""bias_term""bias_term""bias_term""bias_term"
'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output"
'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier"
'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias"
'num_trainable_params'"num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params""num_trainable_params"
'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler""weight_filler"
'weight_filler_const_val'"weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val"
'weight_filler_variance_norm'"weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm"

执行信息

参数

DLLayerInputDLLayerInputDLLayerInputDLLayerInputDLLayerInputdllayer_input (输入控制)  dl_layer HDlLayer, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

输入层。

LayerNameLayerNameLayerNameLayerNamelayerNamelayer_name (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

输出层的名称。

NumOutNumOutNumOutNumOutnumOutnum_out (输入控制)  number HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

输出神经元数量。

默认值: 100

GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制)  attribute.name(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

泛型输入参数名称。

默认值: []

值列表: 'bias_filler'"bias_filler""bias_filler""bias_filler""bias_filler""bias_filler", 'bias_filler_const_val'"bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val""bias_filler_const_val", 'bias_filler_variance_norm'"bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm""bias_filler_variance_norm", 'bias_term'"bias_term""bias_term""bias_term""bias_term""bias_term", 'is_inference_output'"is_inference_output""is_inference_output""is_inference_output""is_inference_output""is_inference_output", 'learning_rate_multiplier'"learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier""learning_rate_multiplier", 'learning_rate_multiplier_bias'"learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias""learning_rate_multiplier_bias", 'weight_filler'"weight_filler""weight_filler""weight_filler""weight_filler""weight_filler", 'weight_filler_const_val'"weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val""weight_filler_const_val", 'weight_filler_variance_norm'"weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm""weight_filler_variance_norm"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制)  attribute.value(-array) HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (string / integer / real) (string / int / long / double) (HString / Hlong / double) (char* / Hlong / double)

泛型输入参数值。

默认值: []

建议值: 'xavier'"xavier""xavier""xavier""xavier""xavier", 'msra'"msra""msra""msra""msra""msra", 'const'"const""const""const""const""const", 'nearest_neighbor'"nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor""nearest_neighbor", 'bilinear'"bilinear""bilinear""bilinear""bilinear""bilinear", 'norm_in'"norm_in""norm_in""norm_in""norm_in""norm_in", 'norm_out'"norm_out""norm_out""norm_out""norm_out""norm_out", 'norm_average'"norm_average""norm_average""norm_average""norm_average""norm_average", 'true'"true""true""true""true""true", 'false'"false""false""false""false""false", 1.0, 0.9, 0.0

DLLayerDenseDLLayerDenseDLLayerDenseDLLayerDenseDLLayerDensedllayer_dense (输出控制)  dl_layer HDlLayer, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

稠密层。

模块

深度学习训练