ngraph/test/op_eval/binary_convolution.cpp
// --------------------- 3D convolution ------------------------------------------
// clang-format off
3D convolution
clang-format off
3D convolution clang - format off
NGRAPH_TEST(op_eval, bin_convolution_3D_1batch_1channel_no_padding)
{
    const Strides strides{1, 1, 1};
    const CoordinateDiff padding{0, 0, 0};
    const Strides dilations{1, 1, 1};
    const Shape inputs_shape{1, 1, 4, 4, 4};
    const std::vector<float> inputs_conv{
                                        1.0f, -1.0f, -1.0f, 1.0f,
                                        -1.0f, 1.0f, -1.0f, 1.0f,
                                        1.0f, 1.0f, -1.0f, 1.0f,
                                        1.0f, -1.0f, 1.0f, -1.0f,
                                        -1.0f, 1.0f, 1.0f, 1.0f,
                                        1.0f, -1.0f, -1.0f, 1.0f,
                                        -1.0f, 1.0f, -1.0f, 1.0f,
                                        1.0f, -1.0f, 1.0f, -1.0f,
                                        1.0f, 1.0f, 1.0f, -1.0f,
                                        -1.0f, 1.0f, -1.0f, 1.0f,
                                        1.0f, 1.0f, -1.0f, 1.0f,
                                        1.0f, -1.0f, 1.0f, -1.0f,
                                        1.0f, -1.0f, 1.0f, -1.0f,
                                        1.0f, 1.0f, -1.0f, 1.0f,
                                        -1.0f, 1.0f, 1.0f, 1.0f,
                                        1.0f, 1.0f, -1.0f, 1.0f
                                        };
    const std::vector<float> inputs_bin_conv{
                                        1.0f, 0.0f, 0.0f, 1.0f,
                                        0.0f, 1.0f, 0.0f, 1.0f,
                                        1.0f, 1.0f, 0.0f, 1.0f,
                                        1.0f, 0.0f, 1.0f, 0.0f,
                                        0.0f, 1.0f, 1.0f, 1.0f,
                                        1.0f, 0.0f, 0.0f, 1.0f,
                                        0.0f, 1.0f, 0.0f, 1.0f,
                                        1.0f, 0.0f, 1.0f, 0.0f,
                                        1.0f, 1.0f, 1.0f, 0.0f,
                                        0.0f, 1.0f, 0.0f, 1.0f,
                                        1.0f, 1.0f, 0.0f, 1.0f,
                                        1.0f, 0.0f, 1.0f, 0.0f,
                                        1.0f, 0.0f, 1.0f, 0.0f,
                                        1.0f, 1.0f, 0.0f, 1.0f,
                                        0.0f, 1.0f, 1.0f, 1.0f,
                                        1.0f, 1.0f, 0.0f, 1.0f
                                        };
    const Shape filters_shape{1, 1, 3, 3, 3};
    const std::vector<float> filters_conv{
                                         1.0f, -1.0f, 1.0f,
                                         -1.0f, 1.0f, -1.0f,
                                         1.0f, -1.0f, 1.0f,
                                         -1.0f, 1.0f, 1.0f,
                                         1.0f, -1.0f, 1.0f,
                                         1.0f, 1.0f, -1.0f,
                                         1.0f, 1.0f, -1.0f,
                                         -1.0f, 1.0f, -1.0f,
                                         1.0f, 1.0f, 1.0f};
     const std::vector<uint8_t> filters_bin_conv{0xAA, 0xBB, 0xB2, 0xE0};
    const Shape outputs_shape{1, 1, 2, 2, 2};
    const std::vector<float> outputs{
                                     13.0f, 3.0f,
                                     -3.0f, -3.0f,
                                     -3.0f, 5.0f,
                                     11.0f, -3.0f};
    BinaryConvolutionTest(
        inputs_bin_conv,
        inputs_shape,
        filters_bin_conv,
        filters_shape,
        outputs,
        outputs_shape,
        strides,
        padding,
        dilations);
    ConvolutionTest(
        inputs_conv,
        inputs_shape,
        filters_conv,
        filters_shape,
        outputs,
        outputs_shape,
        strides,
        padding,
        dilations);
}
NGRAPH_TEST ( op_eval , bin_convolution_3D_1batch_1channel_no_padding ) { const Strides strides { 1 , 1 , 1 } ; const CoordinateDiff padding { 0 , 0 , 0 } ; const Strides dilations { 1 , 1 , 1 } ; const Shape inputs_shape { 1 , 1 , 4 , 4 , 4 } ; const std :: vector < float > inputs_conv { 1.0f , -1.0f , -1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , 1.0f , -1.0f , 1.0f , 1.0f , -1.0f , 1.0f , -1.0f , -1.0f , 1.0f , 1.0f , 1.0f , 1.0f , -1.0f , -1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , 1.0f , -1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , 1.0f , -1.0f , 1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , 1.0f , 1.0f , 1.0f , -1.0f , 1.0f } ; const std :: vector < float > inputs_bin_conv { 1.0f , 0.0f , 0.0f , 1.0f , 0.0f , 1.0f , 0.0f , 1.0f , 1.0f , 1.0f , 0.0f , 1.0f , 1.0f , 0.0f , 1.0f , 0.0f , 0.0f , 1.0f , 1.0f , 1.0f , 1.0f , 0.0f , 0.0f , 1.0f , 0.0f , 1.0f , 0.0f , 1.0f , 1.0f , 0.0f , 1.0f , 0.0f , 1.0f , 1.0f , 1.0f , 0.0f , 0.0f , 1.0f , 0.0f , 1.0f , 1.0f , 1.0f , 0.0f , 1.0f , 1.0f , 0.0f , 1.0f , 0.0f , 1.0f , 0.0f , 1.0f , 0.0f , 1.0f , 1.0f , 0.0f , 1.0f , 0.0f , 1.0f , 1.0f , 1.0f , 1.0f , 1.0f , 0.0f , 1.0f } ; const Shape filters_shape { 1 , 1 , 3 , 3 , 3 } ; const std :: vector < float > filters_conv { 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , 1.0f , -1.0f , 1.0f , 1.0f , 1.0f , -1.0f , 1.0f , 1.0f , -1.0f , -1.0f , 1.0f , -1.0f , 1.0f , 1.0f , 1.0f } ; const std :: vector < uint8_t > filters_bin_conv { 0xAA , 0xBB , 0xB2 , 0xE0 } ; const Shape outputs_shape { 1 , 1 , 2 , 2 , 2 } ; const std :: vector < float > outputs { 13.0f , 3.0f , -3.0f , -3.0f , -3.0f , 5.0f , 11.0f , -3.0f } ; BinaryConvolutionTest ( inputs_bin_conv , inputs_shape , filters_bin_conv , filters_shape , outputs , outputs_shape , strides , padding , dilations ) ; ConvolutionTest ( inputs_conv , inputs_shape , filters_conv , filters_shape , outputs , outputs_shape , strides , padding , dilations ) ; }
3D convolution
clang-format off
3D convolution clang - format off
// depth: 1 // depth: 2 // depth: 3 // depth: 4 // depth: 1 // depth: 2 // depth: 3 // depth: 4 // depth: 1 // depth: 2 // depth: 3 // depth: 1 // depth: 2