Removed builders from public API (#2059)

* Removed builders from public API

* Fixed build
This commit is contained in:
Ilya Churaev
2020-09-04 06:06:43 +03:00
committed by GitHub
parent 0b61a7568f
commit 28eed7708e
26 changed files with 72 additions and 61 deletions

View File

@@ -24,7 +24,7 @@ source_group("include" FILES ${PUBLIC_HEADERS})
add_library(${TARGET_NAME} SHARED ${LIBRARY_SRC} ${PUBLIC_HEADERS})
target_link_libraries(${TARGET_NAME} PUBLIC ${NGRAPH_LIBRARIES}
PRIVATE openvino::itt)
PRIVATE openvino::itt ngraph::builder)
target_include_directories(${TARGET_NAME} PUBLIC ${PUBLIC_HEADERS_DIR})

View File

@@ -10,7 +10,6 @@
#include <transformations_visibility.hpp>
#include <ngraph_ops/fully_connected.hpp>
#include <ngraph/builder/make_constant.hpp>
#include <ngraph/graph_util.hpp>
#include <ngraph/op/add.hpp>
#include <ngraph/pattern/matcher.hpp>

View File

@@ -9,7 +9,6 @@
#include <numeric>
#include <ngraph_ops/fully_connected.hpp>
#include <ngraph/builder/make_constant.hpp>
#include <ngraph/graph_util.hpp>
#include <ngraph/pattern/matcher.hpp>
#include <ngraph/pattern/op/label.hpp>

View File

@@ -7,10 +7,6 @@
#include <memory>
#include <numeric>
#include "ngraph/builder/matmul_factory.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/op/reshape.hpp"
using namespace std;
using namespace ngraph;

View File

@@ -22,6 +22,7 @@ file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
set(NGRAPH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/ngraph CACHE INTERNAL "")
add_subdirectory(builder)
add_subdirectory(reference)
# Create named folders for the sources within the .vcproj
@@ -40,7 +41,7 @@ set_target_properties(ngraph PROPERTIES
C_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON)
target_link_libraries(ngraph PRIVATE openvino::itt ngraph::reference)
target_link_libraries(ngraph PRIVATE openvino::itt ngraph::builder ngraph::reference)
find_package(Graphviz QUIET)
if (GRAPHVIZ_FOUND)
@@ -82,7 +83,6 @@ endif()
# Defines macro in C++ to load backend plugin
target_include_directories(ngraph PUBLIC $<BUILD_INTERFACE:${NGRAPH_INCLUDE_PATH}> $<INSTALL_INTERFACE:include>)
target_include_directories(ngraph PRIVATE ${NGRAPH_INCLUDE_DIR}
${NGRAPH_INCLUDE_DIR}/builder
${NGRAPH_INCLUDE_DIR}/op
${NGRAPH_INCLUDE_DIR}/op/util
${NGRAPH_INCLUDE_DIR}/pass

View File

@@ -0,0 +1,44 @@
# ******************************************************************************
# Copyright 2017-2020 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ******************************************************************************
set(TARGET_NAME "ngraph_builders")
file(GLOB_RECURSE LIBRARY_SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp)
set(BUILDER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/ CACHE INTERNAL "")
# Create named folders for the sources within the .vcproj
# Empty name lists them directly under the .vcproj
source_group("src" FILES ${LIBRARY_SRC})
source_group("include" FILES ${PUBLIC_HEADERS})
# Create shared library
add_library(${TARGET_NAME} STATIC ${LIBRARY_SRC} ${PUBLIC_HEADERS})
# Defines macro in C++ to load backend plugin
target_include_directories(${TARGET_NAME} PUBLIC ${BUILDER_INCLUDE_DIR})
target_include_directories(${TARGET_NAME} PRIVATE ${NGRAPH_INCLUDE_PATH}
${BUILDER_INCLUDE_DIR}/ngraph/
${BUILDER_INCLUDE_DIR}/ngraph/builder)
#Add an alias so that library can be used inside the build tree, e.g. when testing
add_library(ngraph::builder ALIAS ${TARGET_NAME})
# developer package
openvino_developer_export_targets(ngraph::builder)

View File

@@ -27,7 +27,7 @@ namespace ngraph
{
namespace builder
{
class NGRAPH_API numpy_autobroadcast_incompatible_shapes : public ngraph::ngraph_error
class numpy_autobroadcast_incompatible_shapes : public ngraph::ngraph_error
{
public:
numpy_autobroadcast_incompatible_shapes(const ngraph::Shape& shape1,
@@ -55,7 +55,6 @@ namespace ngraph
/// \return Vector of broadcasted values.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector numpy_broadcast_outputs(const OutputVector& values);
///
@@ -68,7 +67,6 @@ namespace ngraph
/// \return Node producing values with requested shape.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
std::shared_ptr<Node> numpy_broadcast(const Output<Node>& value, const Shape& shape);
/// \brief Wrap two graph values, if necessary, to obtain values with identical shapes,
@@ -100,7 +98,6 @@ namespace ngraph
///
/// \exception ngraph::builder::numpy_autobroadcast_incompatible_shapes
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
std::pair<std::shared_ptr<Node>, std::shared_ptr<Node>>
numpy_broadcast(const std::pair<Output<Node>, Output<Node>>& args);
@@ -177,7 +174,6 @@ namespace ngraph
/// \return The vector containing both outputs broadcasted.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector numpy_broadcast_for_matmul_operation(const Output<Node>& left,
const Output<Node>& right);
@@ -189,7 +185,6 @@ namespace ngraph
///
/// \return pdpd-style broadcasted list of nodes.
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector pdpd_broadcast(const OutputVector& inputs, int64_t axis);
/// \brief Generate a list of broadcast axes.
@@ -207,7 +202,6 @@ namespace ngraph
///
/// \return The indices of added axes.
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
AxisSet calculate_broadcast_axes(const Shape& output_shape,
const Shape& input_shape,
std::size_t start_match_axis);
@@ -229,7 +223,6 @@ namespace ngraph
/// padded input shapes ready to be broadcasted as the second object
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
std::pair<Shape, std::vector<Shape>>
get_numpy_broadcast_shapes(const std::vector<Shape>& input_shapes);
@@ -292,7 +285,6 @@ namespace ngraph
///
/// \return The Output object connected to node producing broadcasted right node.
///
NGRAPH_API
Output<Node> legacy_broadcast_for_binary_operation(const Output<Node>& left,
const Output<Node>& right,
size_t start_match_axis);
@@ -305,7 +297,6 @@ namespace ngraph
///
/// \return The vector with axes indexes mapping .
///
NGRAPH_API
std::vector<std::size_t> get_axes_mapping(const Shape& output_shape,
const AxisSet& broadcast_axes);
@@ -319,7 +310,6 @@ namespace ngraph
///
/// \return Returns the Output object pointing to node with the axes mapping.
///
NGRAPH_API
Output<Node> get_axes_mapping_output(const Shape& output_shape,
const Shape& input_shape,
std::size_t start_match_axis);
@@ -332,16 +322,13 @@ namespace ngraph
///
/// \return The Output object with Node returning axes mapping.
///
NGRAPH_API
Output<Node> get_axes_mapping_output(const Shape& output_shape,
const AxisSet& broadcast_axes);
NGRAPH_API
Output<Node> make_broadcast(const Output<Node>& node,
const Shape& target_shape,
const AxisSet& broadcast_axes);
NGRAPH_API
Output<Node> make_broadcast(const Output<Node>& node,
const Shape& target_shape,
std::size_t start_match_axis);

View File

@@ -30,7 +30,7 @@ namespace ngraph
/// floating-point data.
/// Subclasses: `QLinearMatmulFactory` and `MatmulIntegerFactory` implement quantized
/// versions.
class NGRAPH_DEPRECATED("This builder was deprecated.") NGRAPH_API MatmulFactory
class NGRAPH_DEPRECATED("This builder was deprecated.") MatmulFactory
{
public:
explicit MatmulFactory(const OutputVector& inputs)
@@ -60,7 +60,7 @@ namespace ngraph
/// \brief Factory class which generates an nGraph sub-graph based on an ONNX QLinearMatMul
/// operation.
class NGRAPH_DEPRECATED("This builder was deprecated.") NGRAPH_API QLinearMatmulFactory
class NGRAPH_DEPRECATED("This builder was deprecated.") QLinearMatmulFactory
: public MatmulFactory
{
public:
@@ -76,7 +76,7 @@ namespace ngraph
/// \brief Factory class which generates an nGraph sub-graph based on an ONNX MatMulInteger
/// operation.
class NGRAPH_DEPRECATED("This builder was deprecated.") NGRAPH_API MatmulIntegerFactory
class NGRAPH_DEPRECATED("This builder was deprecated.") MatmulIntegerFactory
: public MatmulFactory
{
public:

View File

@@ -46,7 +46,6 @@ namespace ngraph
///
/// \return L-0 norm of value. The output sub-graph is composed of v1 ops.
///
NGRAPH_API
std::shared_ptr<Node> l0_norm(const Output<Node>& value,
const Output<Node>& reduction_axes);
@@ -60,7 +59,6 @@ namespace ngraph
///
/// \return L-1 norm of value. The output sub-graph is composed of v1 ops.
///
NGRAPH_API
std::shared_ptr<Node> l1_norm(const Output<Node>& value,
const Output<Node>& reduction_axes,
float bias = 0.f);
@@ -78,7 +76,6 @@ namespace ngraph
///
/// \return L-2 norm of value. The output sub-graph is composed of v1 ops.
///
NGRAPH_API
std::shared_ptr<Node> l2_norm(const Output<Node>& value,
const Output<Node>& reduction_axes,
float bias = 0.f,
@@ -94,7 +91,6 @@ namespace ngraph
///
/// \return L-p norm of value. The output sub-graph is composed of v1 ops.
///
NGRAPH_API
std::shared_ptr<Node> lp_norm(const Output<Node>& value,
const Output<Node>& reduction_axes,
std::size_t p_norm = 2,

View File

@@ -48,12 +48,10 @@ namespace ngraph
/// | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
/// | \f$E[\textit{delete}(A,d_1,\dots,d_n)]\f$ | The tensor \f$T\f$, where \f$T\f$ is the input tensor with the `reduction_axes` \f$A\f$ eliminated by reduction. |
// clang-format on
NGRAPH_API
std::shared_ptr<Node> mean(const Output<Node>& node,
const AxisSet& reduction_axes,
bool keep_dims = false);
NGRAPH_API
std::shared_ptr<Node> mean(const Output<Node>& node,
const Output<Node>& reduction_axes,
bool keep_dims = false);
@@ -85,12 +83,10 @@ namespace ngraph
/// | ----------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
/// | \f$E[\textit{delete}(A,d_1,\dots,d_n)]\f$ | The tensor \f$T\f$, where \f$T\f$ is the input tensor with the `reduction_axes` \f$A\f$ eliminated by reduction. |
// clang-format on
NGRAPH_API
std::shared_ptr<Node> variance(const Output<Node>& value,
const AxisSet& reduction_axes,
const bool bessel_correction = false);
NGRAPH_API
std::shared_ptr<Node> variance(const Output<Node>& value,
const Output<Node>& reduction_axes,
bool keep_dims = false,

View File

@@ -35,7 +35,6 @@ namespace ngraph
/// \param[in] shape The new shape.
///
/// \return Reshape:v1 op.
NGRAPH_API
std::shared_ptr<Node> reshape(const Output<Node>& value, const Shape& shape);
/// \brief Permute axes according to specified axes_order parameter.
@@ -44,7 +43,6 @@ namespace ngraph
/// \param axes_order The permutation of axes.
///
/// \return Transpose:v1 op.
NGRAPH_API
std::shared_ptr<Node> reorder_axes(const Output<Node>& value,
std::vector<size_t> axes_order = {});
@@ -53,7 +51,6 @@ namespace ngraph
/// \param Value to transpose.
///
/// \return Transpose:v1 op.
NGRAPH_API
std::shared_ptr<Node> transpose(const Output<Node>& value);
/// \brief Flatten a value into a 2D matrix, with a static dividing axis.
@@ -63,7 +60,6 @@ namespace ngraph
///
/// \return The new value will be a 2D matrix representing the flattened input
/// node.
NGRAPH_API
std::shared_ptr<Node> flatten(const Output<Node>& value, int axis);
/// \brief Expands node tensor shape with empty axis at
@@ -74,7 +70,6 @@ namespace ngraph
/// new axis is placed.
///
/// \return Reshape:v1 op.
NGRAPH_API
std::shared_ptr<Node> expand_dims(const Output<Node>& value, std::size_t axis = 0);
/// \brief Remove empty axes from input tensor.
@@ -83,7 +78,6 @@ namespace ngraph
/// \param[in] axes The vector defining indexes of axes to be removed.
///
/// \return Reshape:v1 op.
NGRAPH_API
std::shared_ptr<Node> squeeze(const Output<Node>& value,
std::vector<std::size_t> axes = {0});
@@ -97,7 +91,6 @@ namespace ngraph
///
/// \return The node with collapsed specified axes.
///
NGRAPH_API
std::shared_ptr<Node> collapse(const Output<Node>& value,
const std::size_t start_axis,
const std::size_t end_axis);

View File

@@ -51,7 +51,6 @@ namespace ngraph
/// \return The vector containing multiple outputs we split input node into.
///
NGRAPH_DEPRECATED("This builder was deprecated.")
NGRAPH_API
OutputVector split(const Output<Node>& value, size_t split_parts, int axis = 0);
namespace opset1
@@ -69,7 +68,6 @@ namespace ngraph
/// \return The vector containing multiple outputs we split input node into.
/// The vector is output of Split:v1 op
///
NGRAPH_API
OutputVector split(const Output<Node>& value,
const std::vector<size_t>& split_lengths,
int64_t axis = 0);
@@ -90,7 +88,6 @@ namespace ngraph
/// \return The vector containing multiple nodes we split input node into.
/// The vector is output of VariadicSplit:v1 op
///
NGRAPH_API
OutputVector split(const Output<Node>& value, size_t num_splits, int64_t axis = 0);
}
} // namespace builder

View File

@@ -14,14 +14,14 @@
// limitations under the License.
//*****************************************************************************
#include "ngraph/builder/autobroadcast.hpp"
#include "builder/autobroadcast.hpp"
#include <memory>
#include <numeric>
#include <sstream>
#include "builder/reshape.hpp"
#include "ngraph/axis_vector.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/check.hpp"
#include "ngraph/op/broadcast.hpp"
#include "ngraph/op/constant.hpp"

View File

@@ -19,10 +19,10 @@
#include <memory>
#include <numeric>
#include "ngraph/builder/autobroadcast.hpp"
#include "ngraph/builder/make_constant.hpp"
#include "ngraph/builder/matmul_factory.hpp"
#include "ngraph/builder/reshape.hpp"
#include "builder/autobroadcast.hpp"
#include "builder/make_constant.hpp"
#include "builder/matmul_factory.hpp"
#include "builder/reshape.hpp"
#include "ngraph/op/concat.hpp"
#include "ngraph/op/dot.hpp"
#include "ngraph/op/quantized_dot.hpp"

View File

@@ -16,9 +16,9 @@
#include <numeric>
#include "builder/autobroadcast.hpp"
#include "builder/reduce_ops.hpp"
#include "ngraph/axis_set.hpp"
#include "ngraph/builder/autobroadcast.hpp"
#include "ngraph/builder/reduce_ops.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/divide.hpp"
#include "ngraph/op/multiply.hpp"

View File

@@ -19,8 +19,8 @@
#include <iterator>
#include <numeric>
#include "builder/reshape.hpp"
#include "ngraph/axis_vector.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/op/concat.hpp"
#include "ngraph/op/constant.hpp"
#include "ngraph/op/product.hpp"

View File

@@ -14,7 +14,7 @@
// limitations under the License.
//*****************************************************************************
#include "ngraph/builder/split.hpp"
#include "builder/split.hpp"
#include "ngraph/op/slice.hpp"
#include "ngraph/opsets/opset1.hpp"

View File

@@ -67,9 +67,6 @@ namespace ngraph
#include "ngraph/attribute_adapter.hpp"
#include "ngraph/attribute_visitor.hpp"
#include "ngraph/builder/autobroadcast.hpp"
#include "ngraph/builder/reduce_ops.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/descriptor/input.hpp"
#include "ngraph/descriptor/output.hpp"
#include "ngraph/descriptor/tensor.hpp"

View File

@@ -42,7 +42,7 @@ source_group("include" FILES ${PUBLIC_HEADERS})
# Create shared library
add_library(onnx_importer SHARED ${LIBRARY_SRC} ${PUBLIC_HEADERS})
target_link_libraries(onnx_importer PRIVATE onnx onnx_proto ${Protobuf_LIBRARIES})
target_link_libraries(onnx_importer PRIVATE onnx onnx_proto ${Protobuf_LIBRARIES} ngraph::builder)
target_link_libraries(onnx_importer PUBLIC ngraph)
set_target_properties(onnx_importer PROPERTIES

View File

@@ -392,9 +392,11 @@ if(NGRAPH_ADDRESS_SANITIZER)
add_compile_options(-g -fsanitize=address -fno-omit-frame-pointer)
endif()
target_link_libraries(unit-test PRIVATE ngraph_test_util)
target_link_libraries(unit-test PRIVATE ngraph)
target_link_libraries(unit-test PRIVATE ngraph_backend libgtest)
target_link_libraries(unit-test PRIVATE ngraph_test_util
ngraph
ngraph::builder
ngraph_backend
libgtest)
# Protobuf-lite does not support parsing files from prototxt format
# Since most of the onnx models are stored in this format it have to be disabled

View File

@@ -16,6 +16,8 @@
#include <numeric>
#include "ngraph/builder/reduce_ops.hpp"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/ngraph.hpp"
#include "util/engine/test_engines.hpp"
#include "util/test_case.hpp"

View File

@@ -23,6 +23,7 @@
#include <string>
#include "gtest/gtest.h"
#include "ngraph/builder/reshape.hpp"
#include "ngraph/ngraph.hpp"
#include "ngraph/runtime/tensor.hpp"
#include "runtime/backend.hpp"

View File

@@ -16,6 +16,7 @@
#include "gtest/gtest.h"
#include "ngraph/builder/autobroadcast.hpp"
#include "ngraph/ngraph.hpp"
NGRAPH_SUPPRESS_DEPRECATED_START

View File

@@ -58,6 +58,7 @@ target_compile_definitions(ngraph_backend
SHARED_LIB_SUFFIX="${IE_BUILD_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}"
)
target_link_libraries(ngraph_backend PUBLIC ngraph
ngraph::builder
ngraph::reference)
if (NOT WIN32)
target_link_libraries(ngraph_backend PRIVATE dl)