cntk.contrib.crosstalkcaffe.unimodel.cntkinstance module¶
-
class
ApiSetup
[source]¶ Bases:
object
Setup CNTK ops with given parameters
-
static
batch_norm
(cntk_layer, inputs)[source]¶ - Setup batch normalization op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of batch normalization op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk batch normalization op
Return type: - cntk_layer (
-
static
convolution
(cntk_layer, inputs)[source]¶ - Setup convolution op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of convolution op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk convolution op
Return type: - cntk_layer (
-
static
dense
(cntk_layer, inputs)[source]¶ - Setup dense op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of dense op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk dense op
Return type: - cntk_layer (
-
static
dropout
(cntk_layer, inputs)[source]¶ - Setup dropout op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of dropout op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk dropout op
Return type: - cntk_layer (
-
static
lrn
(cntk_layer, inputs)[source]¶ - Setup lrn op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of lrn op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk lrn op
Return type: - cntk_layer (
-
static
plus
(cntk_layer, inputs)[source]¶ - Setup plus op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of dense op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk dense op
Return type: - cntk_layer (
-
static
pooling
(cntk_layer, inputs)[source]¶ - Setup pooling op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of pooling op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk pooling op
Return type: - cntk_layer (
-
static
relu
(cntk_layer, inputs)[source]¶ - Setup ReLU op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of ReLU op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk ReLU op
Return type: - cntk_layer (
-
static
softmax
(cntk_layer, inputs)[source]¶ - Setup softmax op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of softmax op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk softmax op
Return type: - cntk_layer (
-
static
splice
(cntk_layer, inputs)[source]¶ - Setup splice op with given parameters
Parameters: - cntk_layer (
CntkLayersDefinition
) – the layer definition of splice op - inputs (list) – a list contains all
Function
orinput
Returns: instaced cntk splice op
Return type: - cntk_layer (
-
static
-
class
BlockApiSetup
[source]¶ Bases:
object
Implement some special requirement ops
-
static
convolution
(output, kernel, stride, pad, kernel_init, bias_init, group, dilation, name)[source]¶ - Implement convolution ops
Parameters: - output (int) – the output channel size
- kernel (list) – the kernel size of filter, with format [width, height]
- stride (list) – the stride of convolution, with format [w_stride, h_stride]
- pad (bool) – auto padding or not
- kernel_init (np.array) – the tensor saving initialize values of filter
- bias_init (np.array) – the tensor saving initialize values of bias
- group (int) – the group size in the convolution
- dilation (list) – the dilation of convolution, with format [w_dilation, h_dilation]
- name (str) – the name of ops
Returns: the function contains convolution ops
Return type:
-
static
linear
(output_shape, input_shape, scale_init, bias_init, name)[source]¶ - Implement linear ops, also known as full connection in Caffe
Parameters: - output_shape (tuple) – the output channel size
- input_shape (tuple) – the input channel size
- scale_init (np.array) – the tensor saving initialize values of scale
- bias_init (np.array) – the tensor saving initialize values of bias
- name (str) – the name of ops
Returns: the function contains linear ops
Return type:
-
static
-
class
CntkApiInstance
(cntk_uni_model, global_conf)[source]¶ Bases:
object
Instace CNTK ops and network
-
get_functions
()[source]¶ - Return the functions of CNTK network
Parameters: None – Returns: the instaced functions of CNTK Return type: list
-
get_model
()[source]¶ - Get instaced CNTK model
Parameters: None – Returns: the output node of CNTK Return type: Function()
-