How to use the daal.algorithms.neural_networks.layers.relu.Batch function in daal

To help you get started, we’ve selected a few daal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
res2a_branch2c = convolution2d.Batch(fptype=np.float32)
    res2a_branch2c.parameter.nKernels           = 256
    res2a_branch2c.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res2a_branch2c.parameter.strides            = convolution2d.Strides(1, 1)
    res2a_branch2c.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res2a_branch2c.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res2a_branch2c_id = topology.add(res2a_branch2c)

    bn2a_branch2c = batch_normalization.Batch(fptype=np.float32)
    bn2a_branch2c_id = topology.add(bn2a_branch2c)

    res2a = eltwise_sum.Batch(fptype=np.float32)
    res2a_id = topology.add(res2a)

    res2a_relu = relu.Batch(fptype=np.float32)
    res2a_relu_id = topology.add(res2a_relu)

    res2a_relu_split2 = split.Batch(2, 2, fptype=np.float32)
    res2a_relu_split2_id = topology.add(res2a_relu_split2)

    res2b_branch2a = convolution2d.Batch(fptype=np.float32)
    res2b_branch2a.parameter.nKernels           = 64
    res2b_branch2a.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res2b_branch2a.parameter.strides            = convolution2d.Strides(1, 1)
    res2b_branch2a.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res2b_branch2a.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res2b_branch2a_id = topology.add(res2b_branch2a)

    bn2b_branch2a = batch_normalization.Batch(fptype=np.float32)
    bn2b_branch2a_id = topology.add(bn2b_branch2a)
github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
res3a_branch2a_relu = relu.Batch(fptype=np.float32)
    res3a_branch2a_relu_id = topology.add(res3a_branch2a_relu)

    res3a_branch2b = convolution2d.Batch(fptype=np.float32)
    res3a_branch2b.parameter.nKernels           = 128
    res3a_branch2b.parameter.kernelSizes        = convolution2d.KernelSizes(3, 3)
    res3a_branch2b.parameter.strides            = convolution2d.Strides(1, 1)
    res3a_branch2b.parameter.paddings           = convolution2d.Paddings(1, 1)
    res3a_branch2b.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3a_branch2b.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3a_branch2b_id = topology.add(res3a_branch2b)

    bn3a_branch2b = batch_normalization.Batch(fptype=np.float32)
    bn3a_branch2b_id = topology.add(bn3a_branch2b)

    res3a_branch2b_relu = relu.Batch(fptype=np.float32)
    res3a_branch2b_relu_id = topology.add(res3a_branch2b_relu)

    res3a_branch2c = convolution2d.Batch(fptype=np.float32)
    res3a_branch2c.parameter.nKernels           = 512
    res3a_branch2c.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res3a_branch2c.parameter.strides            = convolution2d.Strides(1, 1)
    res3a_branch2c.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3a_branch2c.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3a_branch2c_id = topology.add(res3a_branch2c)

    bn3a_branch2c = batch_normalization.Batch(fptype=np.float32)
    bn3a_branch2c_id = topology.add(bn3a_branch2c)

    res3a = eltwise_sum.Batch(fptype=np.float32)
    res3a_id = topology.add(res3a)
github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
res4a_branch2c = convolution2d.Batch(fptype=np.float32)
    res4a_branch2c.parameter.nKernels           = 1024
    res4a_branch2c.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res4a_branch2c.parameter.strides            = convolution2d.Strides(1, 1)
    res4a_branch2c.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res4a_branch2c.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res4a_branch2c_id = topology.add(res4a_branch2c)

    bn4a_branch2c = batch_normalization.Batch(fptype=np.float32)
    bn4a_branch2c_id = topology.add(bn4a_branch2c)

    res4a = eltwise_sum.Batch(fptype=np.float32)
    res4a_id = topology.add(res4a)

    res4a_relu = relu.Batch(fptype=np.float32)
    res4a_relu_id = topology.add(res4a_relu)

    res4a_relu_split9 = split.Batch(2, 2, fptype=np.float32)
    res4a_relu_split9_id = topology.add(res4a_relu_split9)

    res4b_branch2a = convolution2d.Batch(fptype=np.float32)
    res4b_branch2a.parameter.nKernels           = 256
    res4b_branch2a.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res4b_branch2a.parameter.strides            = convolution2d.Strides(1, 1)
    res4b_branch2a.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res4b_branch2a.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res4b_branch2a_id = topology.add(res4b_branch2a)

    bn4b_branch2a = batch_normalization.Batch(fptype=np.float32)
    bn4b_branch2a_id = topology.add(bn4b_branch2a)
github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
bn3a_branch1 = batch_normalization.Batch(fptype=np.float32)
    bn3a_branch1_id = topology.add(bn3a_branch1)

    res3a_branch2a = convolution2d.Batch(fptype=np.float32)
    res3a_branch2a.parameter.nKernels           = 128
    res3a_branch2a.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res3a_branch2a.parameter.strides            = convolution2d.Strides(2, 2)
    res3a_branch2a.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3a_branch2a.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3a_branch2a_id = topology.add(res3a_branch2a)

    bn3a_branch2a = batch_normalization.Batch(fptype=np.float32)
    bn3a_branch2a_id = topology.add(bn3a_branch2a)

    res3a_branch2a_relu = relu.Batch(fptype=np.float32)
    res3a_branch2a_relu_id = topology.add(res3a_branch2a_relu)

    res3a_branch2b = convolution2d.Batch(fptype=np.float32)
    res3a_branch2b.parameter.nKernels           = 128
    res3a_branch2b.parameter.kernelSizes        = convolution2d.KernelSizes(3, 3)
    res3a_branch2b.parameter.strides            = convolution2d.Strides(1, 1)
    res3a_branch2b.parameter.paddings           = convolution2d.Paddings(1, 1)
    res3a_branch2b.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3a_branch2b.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3a_branch2b_id = topology.add(res3a_branch2b)

    bn3a_branch2b = batch_normalization.Batch(fptype=np.float32)
    bn3a_branch2b_id = topology.add(bn3a_branch2b)

    res3a_branch2b_relu = relu.Batch(fptype=np.float32)
    res3a_branch2b_relu_id = topology.add(res3a_branch2b_relu)
github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
res2b_branch2a_relu = relu.Batch(fptype=np.float32)
    res2b_branch2a_relu_id = topology.add(res2b_branch2a_relu)

    res2b_branch2b = convolution2d.Batch(fptype=np.float32)
    res2b_branch2b.parameter.nKernels           = 64
    res2b_branch2b.parameter.kernelSizes        = convolution2d.KernelSizes(3, 3)
    res2b_branch2b.parameter.strides            = convolution2d.Strides(1, 1)
    res2b_branch2b.parameter.paddings           = convolution2d.Paddings(1, 1)
    res2b_branch2b.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res2b_branch2b.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res2b_branch2b_id = topology.add(res2b_branch2b)

    bn2b_branch2b = batch_normalization.Batch(fptype=np.float32)
    bn2b_branch2b_id = topology.add(bn2b_branch2b)

    res2b_branch2b_relu = relu.Batch(fptype=np.float32)
    res2b_branch2b_relu_id = topology.add(res2b_branch2b_relu)

    res2b_branch2c = convolution2d.Batch(fptype=np.float32)
    res2b_branch2c.parameter.nKernels           = 256
    res2b_branch2c.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res2b_branch2c.parameter.strides            = convolution2d.Strides(1, 1)
    res2b_branch2c.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res2b_branch2c.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res2b_branch2c_id = topology.add(res2b_branch2c)

    bn2b_branch2c = batch_normalization.Batch(fptype=np.float32)
    bn2b_branch2c_id = topology.add(bn2b_branch2c)

    res2b = eltwise_sum.Batch(fptype=np.float32)
    res2b_id = topology.add(res2b)
github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
res3c_relu_split7 = split.Batch(2, 2, fptype=np.float32)
    res3c_relu_split7_id = topology.add(res3c_relu_split7)

    res3d_branch2a = convolution2d.Batch(fptype=np.float32)
    res3d_branch2a.parameter.nKernels           = 128
    res3d_branch2a.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res3d_branch2a.parameter.strides            = convolution2d.Strides(1, 1)
    res3d_branch2a.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3d_branch2a.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3d_branch2a_id = topology.add(res3d_branch2a)

    bn3d_branch2a = batch_normalization.Batch(fptype=np.float32)
    bn3d_branch2a_id = topology.add(bn3d_branch2a)

    res3d_branch2a_relu = relu.Batch(fptype=np.float32)
    res3d_branch2a_relu_id = topology.add(res3d_branch2a_relu)

    res3d_branch2b = convolution2d.Batch(fptype=np.float32)
    res3d_branch2b.parameter.nKernels           = 128
    res3d_branch2b.parameter.kernelSizes        = convolution2d.KernelSizes(3, 3)
    res3d_branch2b.parameter.strides            = convolution2d.Strides(1, 1)
    res3d_branch2b.parameter.paddings           = convolution2d.Paddings(1, 1)
    res3d_branch2b.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3d_branch2b.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3d_branch2b_id = topology.add(res3d_branch2b)

    bn3d_branch2b = batch_normalization.Batch(fptype=np.float32)
    bn3d_branch2b_id = topology.add(bn3d_branch2b)

    res3d_branch2b_relu = relu.Batch(fptype=np.float32)
    res3d_branch2b_relu_id = topology.add(res3d_branch2b_relu)
github intel / daal / samples / python / neural_networks / sources / daal_alexnet.py View on Github external
maxpooling1.parameter.kernelSizes = pooling2d.KernelSizes(3, 3)
    maxpooling1.parameter.paddings = pooling2d.Paddings(0, 0)
    maxpooling1.parameter.strides = pooling2d.Strides(2, 2)

    # convolution: 5x5@256 + 1x1s
    convolution2 = convolution2d.Batch()
    convolution2.parameter.kernelSizes = convolution2d.KernelSizes(5, 5)
    convolution2.parameter.strides = convolution2d.Strides(1, 1)
    convolution2.parameter.paddings = convolution2d.Paddings(2, 2)
    convolution2.parameter.nKernels = 256
    convolution2.parameter.nGroups = 2
    convolution2.parameter.weightsInitializer = gaussian.Batch(0, 0.01)
    convolution2.parameter.biasesInitializer = uniform.Batch(0, 0)

    # relu
    relu2 = relu.Batch()

    # lrn: alpha=0.0001, beta=0.75, local_size=5
    lrn2 = lrn.Batch()
    lrn2.parameter.kappa = 1
    lrn2.parameter.nAdjust = 5
    lrn2.parameter.alpha = 0.0001 / lrn2.parameter.nAdjust
    lrn2.parameter.beta = 0.75

    # pooling: 3x3 + 2x2s
    maxpooling2 = maximum_pooling2d.Batch(4)
    maxpooling2.parameter.kernelSizes = pooling2d.KernelSizes(3, 3)
    maxpooling2.parameter.paddings = pooling2d.Paddings(0, 0)
    maxpooling2.parameter.strides = pooling2d.Strides(2, 2)

    # convolution: 3x3@384 + 2x2s
    convolution3 = convolution2d.Batch()
github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
res3c_branch2a_relu = relu.Batch(fptype=np.float32)
    res3c_branch2a_relu_id = topology.add(res3c_branch2a_relu)

    res3c_branch2b = convolution2d.Batch(fptype=np.float32)
    res3c_branch2b.parameter.nKernels           = 128
    res3c_branch2b.parameter.kernelSizes        = convolution2d.KernelSizes(3, 3)
    res3c_branch2b.parameter.strides            = convolution2d.Strides(1, 1)
    res3c_branch2b.parameter.paddings           = convolution2d.Paddings(1, 1)
    res3c_branch2b.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3c_branch2b.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3c_branch2b_id = topology.add(res3c_branch2b)

    bn3c_branch2b = batch_normalization.Batch(fptype=np.float32)
    bn3c_branch2b_id = topology.add(bn3c_branch2b)

    res3c_branch2b_relu = relu.Batch(fptype=np.float32)
    res3c_branch2b_relu_id = topology.add(res3c_branch2b_relu)

    res3c_branch2c = convolution2d.Batch(fptype=np.float32)
    res3c_branch2c.parameter.nKernels           = 512
    res3c_branch2c.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res3c_branch2c.parameter.strides            = convolution2d.Strides(1, 1)
    res3c_branch2c.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res3c_branch2c.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res3c_branch2c_id = topology.add(res3c_branch2c)

    bn3c_branch2c = batch_normalization.Batch(fptype=np.float32)
    bn3c_branch2c_id = topology.add(bn3c_branch2c)

    res3c = eltwise_sum.Batch(fptype=np.float32)
    res3c_id = topology.add(res3c)
github intel / daal / samples / python / neural_networks / sources / daal_resnet_50.py View on Github external
res5b_branch2a_relu = relu.Batch(fptype=np.float32)
    res5b_branch2a_relu_id = topology.add(res5b_branch2a_relu)

    res5b_branch2b = convolution2d.Batch(fptype=np.float32)
    res5b_branch2b.parameter.nKernels           = 512
    res5b_branch2b.parameter.kernelSizes        = convolution2d.KernelSizes(3, 3)
    res5b_branch2b.parameter.strides            = convolution2d.Strides(1, 1)
    res5b_branch2b.parameter.paddings           = convolution2d.Paddings(1, 1)
    res5b_branch2b.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res5b_branch2b.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res5b_branch2b_id = topology.add(res5b_branch2b)

    bn5b_branch2b = batch_normalization.Batch(fptype=np.float32)
    bn5b_branch2b_id = topology.add(bn5b_branch2b)

    res5b_branch2b_relu = relu.Batch(fptype=np.float32)
    res5b_branch2b_relu_id = topology.add(res5b_branch2b_relu)

    res5b_branch2c = convolution2d.Batch(fptype=np.float32)
    res5b_branch2c.parameter.nKernels           = 2048
    res5b_branch2c.parameter.kernelSizes        = convolution2d.KernelSizes(1, 1)
    res5b_branch2c.parameter.strides            = convolution2d.Strides(1, 1)
    res5b_branch2c.parameter.weightsInitializer = xavier.Batch(fptype=np.float32)
    res5b_branch2c.parameter.biasesInitializer  = uniform.Batch(0, 0, fptype=np.float32)
    res5b_branch2c_id = topology.add(res5b_branch2c)

    bn5b_branch2c = batch_normalization.Batch(fptype=np.float32)
    bn5b_branch2c_id = topology.add(bn5b_branch2c)

    res5b = eltwise_sum.Batch(fptype=np.float32)
    res5b_id = topology.add(res5b)
github intel / daal / samples / python / neural_networks / sources / daal_googlenet_v1.py View on Github external
def configureNet():

    topology = training.Topology()

    # convolution(conv1/7x7_s2): 7x7@64 + 2x2s
    conv1_7x7_s2 = convolution2d.Batch()
    conv1_7x7_s2.parameter.nKernels = 64
    conv1_7x7_s2.parameter.kernelSizes = convolution2d.KernelSizes(7, 7)
    conv1_7x7_s2.parameter.strides = convolution2d.Strides(2, 2)
    conv1_7x7_s2.parameter.paddings = convolution2d.Paddings(3, 3)
    conv1_7x7_s2.parameter.weightsInitializer = xavier.Batch()
    conv1_7x7_s2.parameter.biasesInitializer = uniform.Batch(0.2, 0.2)
    conv1_7x7_s2_id = topology.add(conv1_7x7_s2)

    # relu(conv1/relu_7x7)
    conv1_relu_7x7 = relu.Batch()
    conv1_relu_7x7_id = topology.add(conv1_relu_7x7)

    # pooling(pool1/3x3_s2): 3x3 + 2x2s
    pool1_3x3_s2 = maximum_pooling2d.Batch(4)
    pool1_3x3_s2.parameter.kernelSizes = pooling2d.KernelSizes(3, 3)
    pool1_3x3_s2.parameter.strides = pooling2d.Strides(2, 2)
    pool1_3x3_s2_id = topology.add(pool1_3x3_s2)

    # lrn(pool1/norm1): alpha=0.0001, beta=0.75, local_size=5
    pool1_norm1 = lrn.Batch()
    pool1_norm1.parameter.kappa = 1
    pool1_norm1.parameter.nAdjust = 5
    pool1_norm1.parameter.beta = 0.75
    pool1_norm1.parameter.alpha = 0.0001 / pool1_norm1.parameter.nAdjust
    pool1_norm1_id = topology.add(pool1_norm1)