Unverified Commit a2d1742e authored by Ilya Lavrenov's avatar Ilya Lavrenov Committed by GitHub

Trying to compile with hidden visibility (#4440)

* Trying to compile with hidden visility

* Export more functions needed for Inference Engine

* Update CMakeLists.txt
Co-authored-by: 's avatarRobert Kimball <robert.kimball@intel.com>
parent 517a35e6
...@@ -384,9 +384,9 @@ if (WIN32) ...@@ -384,9 +384,9 @@ if (WIN32)
else() else()
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
# These can be uncommented once we have visibility fully in place set(CMAKE_CXX_VISIBILITY_PRESET default)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") set(CMAKE_C_VISIBILITY_PRESET default)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF)
endif() endif()
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$" AND NOT NGRAPH_BUILD_DIR) if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$" AND NOT NGRAPH_BUILD_DIR)
...@@ -426,7 +426,6 @@ endif() ...@@ -426,7 +426,6 @@ endif()
if(WIN32) if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif() endif()
if (NGRAPH_CPU_ENABLE) if (NGRAPH_CPU_ENABLE)
......
...@@ -658,6 +658,11 @@ else() ...@@ -658,6 +658,11 @@ else()
add_library(ngraph SHARED ${SRC}) add_library(ngraph SHARED ${SRC})
endif() endif()
set_target_properties(ngraph PROPERTIES
CXX_VISIBILITY_PRESET hidden
C_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON)
if(NOT NGRAPH_JSON_ENABLE) if(NOT NGRAPH_JSON_ENABLE)
target_compile_definitions(ngraph PUBLIC NGRAPH_JSON_DISABLE) target_compile_definitions(ngraph PUBLIC NGRAPH_JSON_DISABLE)
endif() endif()
......
...@@ -34,7 +34,7 @@ namespace ngraph ...@@ -34,7 +34,7 @@ namespace ngraph
namespace autodiff namespace autodiff
{ {
class Adjoints class NGRAPH_API Adjoints
{ {
public: public:
/// \brief (dy/dx)(c) for all x used to compute y /// \brief (dy/dx)(c) for all x used to compute y
......
...@@ -63,5 +63,6 @@ namespace ngraph ...@@ -63,5 +63,6 @@ namespace ngraph
void set(const std::vector<int64_t>& value) override; void set(const std::vector<int64_t>& value) override;
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const AxisSet& axis_set); std::ostream& operator<<(std::ostream& s, const AxisSet& axis_set);
} }
...@@ -51,5 +51,6 @@ namespace ngraph ...@@ -51,5 +51,6 @@ namespace ngraph
NGRAPH_API AxisVector& operator=(AxisVector&& v) noexcept; NGRAPH_API AxisVector& operator=(AxisVector&& v) noexcept;
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const AxisVector& axis_vector); std::ostream& operator<<(std::ostream& s, const AxisVector& axis_vector);
} }
...@@ -27,7 +27,7 @@ namespace ngraph ...@@ -27,7 +27,7 @@ namespace ngraph
{ {
namespace builder namespace builder
{ {
class numpy_autobroadcast_incompatible_shapes : public ngraph::ngraph_error class NGRAPH_API numpy_autobroadcast_incompatible_shapes : public ngraph::ngraph_error
{ {
public: public:
numpy_autobroadcast_incompatible_shapes(const ngraph::Shape& shape1, numpy_autobroadcast_incompatible_shapes(const ngraph::Shape& shape1,
...@@ -54,6 +54,7 @@ namespace ngraph ...@@ -54,6 +54,7 @@ namespace ngraph
/// ///
/// \return Vector of broadcasted values. /// \return Vector of broadcasted values.
/// ///
NGRAPH_API
OutputVector numpy_broadcast_outputs(const OutputVector& values); OutputVector numpy_broadcast_outputs(const OutputVector& values);
/// ///
...@@ -65,6 +66,7 @@ namespace ngraph ...@@ -65,6 +66,7 @@ namespace ngraph
/// ///
/// \return Node producing values with requested shape. /// \return Node producing values with requested shape.
/// ///
NGRAPH_API
std::shared_ptr<Node> numpy_broadcast(const Output<Node>& value, const Shape& shape); 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, /// \brief Wrap two graph values, if necessary, to obtain values with identical shapes,
...@@ -95,6 +97,7 @@ namespace ngraph ...@@ -95,6 +97,7 @@ namespace ngraph
/// elements point to ngraph::Node objects whose output values have the same shape. /// elements point to ngraph::Node objects whose output values have the same shape.
/// ///
/// \exception ngraph::builder::numpy_autobroadcast_incompatible_shapes /// \exception ngraph::builder::numpy_autobroadcast_incompatible_shapes
NGRAPH_API
std::pair<std::shared_ptr<Node>, std::shared_ptr<Node>> std::pair<std::shared_ptr<Node>, std::shared_ptr<Node>>
numpy_broadcast(const std::pair<Output<Node>, Output<Node>>& args); numpy_broadcast(const std::pair<Output<Node>, Output<Node>>& args);
...@@ -168,6 +171,7 @@ namespace ngraph ...@@ -168,6 +171,7 @@ namespace ngraph
/// ///
/// \return Left and right node after broadcasting. /// \return Left and right node after broadcasting.
/// ///
NGRAPH_API
OutputVector legacy_broadcast_for_binary_operation(const Output<Node>& left, OutputVector legacy_broadcast_for_binary_operation(const Output<Node>& left,
const Output<Node>& right, const Output<Node>& right,
size_t start_match_axis); size_t start_match_axis);
...@@ -188,6 +192,7 @@ namespace ngraph ...@@ -188,6 +192,7 @@ namespace ngraph
/// ///
/// \return The vector containing both outputs broadcasted. /// \return The vector containing both outputs broadcasted.
/// ///
NGRAPH_API
OutputVector numpy_broadcast_for_matmul_operation(const Output<Node>& left, OutputVector numpy_broadcast_for_matmul_operation(const Output<Node>& left,
const Output<Node>& right); const Output<Node>& right);
...@@ -198,6 +203,7 @@ namespace ngraph ...@@ -198,6 +203,7 @@ namespace ngraph
/// \param axis Index starting to align /// \param axis Index starting to align
/// ///
/// \return pdpd-style broadcasted list of nodes. /// \return pdpd-style broadcasted list of nodes.
NGRAPH_API
OutputVector pdpd_broadcast(const OutputVector& inputs, int64_t axis); OutputVector pdpd_broadcast(const OutputVector& inputs, int64_t axis);
/// \brief Generate a list of broadcast axes. /// \brief Generate a list of broadcast axes.
...@@ -214,6 +220,7 @@ namespace ngraph ...@@ -214,6 +220,7 @@ namespace ngraph
/// matches the desired new shape. /// matches the desired new shape.
/// ///
/// \return The indices of added axes. /// \return The indices of added axes.
NGRAPH_API
AxisSet calculate_broadcast_axes(const Shape& output_shape, AxisSet calculate_broadcast_axes(const Shape& output_shape,
const Shape& input_shape, const Shape& input_shape,
std::size_t start_match_axis); std::size_t start_match_axis);
...@@ -268,6 +275,7 @@ namespace ngraph ...@@ -268,6 +275,7 @@ namespace ngraph
/// ///
/// \return The Output object connected to node producing broadcasted right node. /// \return The Output object connected to node producing broadcasted right node.
/// ///
NGRAPH_API
Output<Node> legacy_broadcast_for_binary_operation(const Output<Node>& left, Output<Node> legacy_broadcast_for_binary_operation(const Output<Node>& left,
const Output<Node>& right, const Output<Node>& right,
size_t start_match_axis); size_t start_match_axis);
...@@ -280,6 +288,7 @@ namespace ngraph ...@@ -280,6 +288,7 @@ namespace ngraph
/// ///
/// \return The vector with axes indexes mapping . /// \return The vector with axes indexes mapping .
/// ///
NGRAPH_API
std::vector<std::size_t> get_axes_mapping(const Shape& output_shape, std::vector<std::size_t> get_axes_mapping(const Shape& output_shape,
const AxisSet& broadcast_axes); const AxisSet& broadcast_axes);
...@@ -293,6 +302,7 @@ namespace ngraph ...@@ -293,6 +302,7 @@ namespace ngraph
/// ///
/// \return Returns the Output object pointing to node with the axes mapping. /// \return Returns the Output object pointing to node with the axes mapping.
/// ///
NGRAPH_API
Output<Node> get_axes_mapping_output(const Shape& output_shape, Output<Node> get_axes_mapping_output(const Shape& output_shape,
const Shape& input_shape, const Shape& input_shape,
std::size_t start_match_axis); std::size_t start_match_axis);
...@@ -305,13 +315,16 @@ namespace ngraph ...@@ -305,13 +315,16 @@ namespace ngraph
/// ///
/// \return The Output object with Node returning axes mapping. /// \return The Output object with Node returning axes mapping.
/// ///
NGRAPH_API
Output<Node> get_axes_mapping_output(const Shape& output_shape, Output<Node> get_axes_mapping_output(const Shape& output_shape,
const AxisSet& broadcast_axes); const AxisSet& broadcast_axes);
NGRAPH_API
Output<Node> make_broadcast(const Output<Node>& node, Output<Node> make_broadcast(const Output<Node>& node,
const Shape& target_shape, const Shape& target_shape,
const AxisSet& broadcast_axes); const AxisSet& broadcast_axes);
NGRAPH_API
Output<Node> make_broadcast(const Output<Node>& node, Output<Node> make_broadcast(const Output<Node>& node,
const Shape& target_shape, const Shape& target_shape,
std::size_t start_match_axis); std::size_t start_match_axis);
......
...@@ -26,6 +26,7 @@ namespace ngraph ...@@ -26,6 +26,7 @@ namespace ngraph
{ {
namespace builder namespace builder
{ {
NGRAPH_API
std::shared_ptr<Node> DequantizeBuilder(const Output<Node>& input, std::shared_ptr<Node> DequantizeBuilder(const Output<Node>& input,
const Output<Node>& min, const Output<Node>& min,
const Output<Node>& max, const Output<Node>& max,
......
...@@ -46,6 +46,7 @@ namespace ngraph ...@@ -46,6 +46,7 @@ namespace ngraph
/// ///
/// \return L-0 norm of value. The output sub-graph is composed of v1 ops. /// \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 AxisSet& reduction_axes); std::shared_ptr<Node> l0_norm(const Output<Node>& value, const AxisSet& reduction_axes);
/// \brief Calculates L-1 norm of a value. /// \brief Calculates L-1 norm of a value.
...@@ -58,6 +59,7 @@ namespace ngraph ...@@ -58,6 +59,7 @@ namespace ngraph
/// ///
/// \return L-1 norm of value. The output sub-graph is composed of v1 ops. /// \return L-1 norm of value. The output sub-graph is composed of v1 ops.
/// ///
NGRAPH_API
std::shared_ptr<Node> std::shared_ptr<Node>
l1_norm(const Output<Node>& value, const AxisSet& reduction_axes, float bias = 0.f); l1_norm(const Output<Node>& value, const AxisSet& reduction_axes, float bias = 0.f);
...@@ -74,6 +76,7 @@ namespace ngraph ...@@ -74,6 +76,7 @@ namespace ngraph
/// ///
/// \return L-2 norm of value. The output sub-graph is composed of v1 ops. /// \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, std::shared_ptr<Node> l2_norm(const Output<Node>& value,
const AxisSet& reduction_axes, const AxisSet& reduction_axes,
float bias = 0.f, float bias = 0.f,
...@@ -89,6 +92,7 @@ namespace ngraph ...@@ -89,6 +92,7 @@ namespace ngraph
/// ///
/// \return L-p norm of value. The output sub-graph is composed of v1 ops. /// \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, std::shared_ptr<Node> lp_norm(const Output<Node>& value,
const AxisSet& reduction_axes, const AxisSet& reduction_axes,
std::size_t p_norm = 2, std::size_t p_norm = 2,
......
...@@ -47,6 +47,7 @@ namespace ngraph ...@@ -47,6 +47,7 @@ namespace ngraph
/// | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | /// | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
/// | \f$E[d_{n-1},\dots,d_0)]\textit{ or }E[d_{order[0]},\dots,d_{order[n-1]}]\f$ | The tensor \f$T\f$, where \f$T\f$ is the input tensor with the axes reordered via Numpy Transpose rules | /// | \f$E[d_{n-1},\dots,d_0)]\textit{ or }E[d_{order[0]},\dots,d_{order[n-1]}]\f$ | The tensor \f$T\f$, where \f$T\f$ is the input tensor with the axes reordered via Numpy Transpose rules |
// clang-format on // clang-format on
NGRAPH_API
std::shared_ptr<Node> numpy_transpose(const Output<Node>& value, AxisVector order = {}); std::shared_ptr<Node> numpy_transpose(const Output<Node>& value, AxisVector order = {});
} // namespace builder } // namespace builder
} // namespace ngraph } // namespace ngraph
...@@ -26,6 +26,7 @@ namespace ngraph ...@@ -26,6 +26,7 @@ namespace ngraph
{ {
namespace builder namespace builder
{ {
NGRAPH_API
std::shared_ptr<Node> QuantizeBuilder(const Output<Node>& input, std::shared_ptr<Node> QuantizeBuilder(const Output<Node>& input,
const Output<Node>& min, const Output<Node>& min,
const Output<Node>& max, const Output<Node>& max,
......
...@@ -31,6 +31,7 @@ namespace ngraph ...@@ -31,6 +31,7 @@ namespace ngraph
{ {
namespace builder namespace builder
{ {
NGRAPH_API
std::shared_ptr<Node> QuantizedConcatBuilder(const NodeVector& args, std::shared_ptr<Node> QuantizedConcatBuilder(const NodeVector& args,
size_t concatenation_axis, size_t concatenation_axis,
const NodeVector& mins, const NodeVector& mins,
......
...@@ -30,6 +30,7 @@ namespace ngraph ...@@ -30,6 +30,7 @@ namespace ngraph
{ {
namespace builder namespace builder
{ {
NGRAPH_API
std::shared_ptr<Node> std::shared_ptr<Node>
QuantizedConvolutionBuilder(const Output<Node>& input, QuantizedConvolutionBuilder(const Output<Node>& input,
const Output<Node>& filters, const Output<Node>& filters,
...@@ -49,6 +50,7 @@ namespace ngraph ...@@ -49,6 +50,7 @@ namespace ngraph
const ngraph::AxisSet& filter_axes = ngraph::AxisSet{}, const ngraph::AxisSet& filter_axes = ngraph::AxisSet{},
const ngraph::AxisSet& output_axes = ngraph::AxisSet{}); const ngraph::AxisSet& output_axes = ngraph::AxisSet{});
NGRAPH_API
std::shared_ptr<Node> std::shared_ptr<Node>
QuantizedConvolutionBiasBuilder(const Output<Node>& input, QuantizedConvolutionBiasBuilder(const Output<Node>& input,
const Output<Node>& filters, const Output<Node>& filters,
...@@ -66,6 +68,7 @@ namespace ngraph ...@@ -66,6 +68,7 @@ namespace ngraph
const Output<Node>& max_output, const Output<Node>& max_output,
const bool with_relu = false); const bool with_relu = false);
NGRAPH_API
std::shared_ptr<Node> std::shared_ptr<Node>
QuantizedConvolutionReluBuilder(const Output<Node>& input, QuantizedConvolutionReluBuilder(const Output<Node>& input,
const Output<Node>& filters, const Output<Node>& filters,
...@@ -81,6 +84,7 @@ namespace ngraph ...@@ -81,6 +84,7 @@ namespace ngraph
const Output<Node>& min_output, const Output<Node>& min_output,
const Output<Node>& max_output); const Output<Node>& max_output);
NGRAPH_API
std::shared_ptr<Node> std::shared_ptr<Node>
QuantizedConvolutionBiasAddBuilder(const Output<Node>& input, QuantizedConvolutionBiasAddBuilder(const Output<Node>& input,
const Output<Node>& filters, const Output<Node>& filters,
...@@ -101,6 +105,7 @@ namespace ngraph ...@@ -101,6 +105,7 @@ namespace ngraph
const Output<Node>& max_sum_input, const Output<Node>& max_sum_input,
const bool with_relu = false); const bool with_relu = false);
NGRAPH_API
std::shared_ptr<Node> std::shared_ptr<Node>
QuantizedConvolutionBiasSignedAddBuilder(const Output<Node>& input, QuantizedConvolutionBiasSignedAddBuilder(const Output<Node>& input,
const Output<Node>& filters, const Output<Node>& filters,
......
...@@ -28,6 +28,7 @@ namespace ngraph ...@@ -28,6 +28,7 @@ namespace ngraph
{ {
namespace builder namespace builder
{ {
NGRAPH_API
std::shared_ptr<Node> QuantizedDotBuilder(const Output<Node>& input0, std::shared_ptr<Node> QuantizedDotBuilder(const Output<Node>& input0,
const Output<Node>& input1, const Output<Node>& input1,
const size_t reduction_axes_count, const size_t reduction_axes_count,
...@@ -42,6 +43,7 @@ namespace ngraph ...@@ -42,6 +43,7 @@ namespace ngraph
const ngraph::AxisSet& input1_axes, const ngraph::AxisSet& input1_axes,
const ngraph::AxisSet& output_axes); const ngraph::AxisSet& output_axes);
NGRAPH_API
std::shared_ptr<Node> QuantizedDotBiasBuilder(const Output<Node>& input, std::shared_ptr<Node> QuantizedDotBiasBuilder(const Output<Node>& input,
const Output<Node>& filters, const Output<Node>& filters,
const Output<Node>& bias, const Output<Node>& bias,
......
...@@ -45,6 +45,7 @@ namespace ngraph ...@@ -45,6 +45,7 @@ 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. | /// | \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 // clang-format on
NGRAPH_API
std::shared_ptr<Node> l2_norm(const Output<Node>& value, const AxisSet& reduction_axes); std::shared_ptr<Node> l2_norm(const Output<Node>& value, const AxisSet& reduction_axes);
// clang-format off // clang-format off
...@@ -69,6 +70,7 @@ namespace ngraph ...@@ -69,6 +70,7 @@ 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. | /// | \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 // clang-format on
NGRAPH_API
std::shared_ptr<Node> mean(const Output<Node>& node, const AxisSet& reduction_axes); std::shared_ptr<Node> mean(const Output<Node>& node, const AxisSet& reduction_axes);
// clang-format off // clang-format off
...@@ -98,6 +100,7 @@ namespace ngraph ...@@ -98,6 +100,7 @@ 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. | /// | \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 // clang-format on
NGRAPH_API
std::shared_ptr<Node> std_dev(const Output<Node>& value, std::shared_ptr<Node> std_dev(const Output<Node>& value,
const AxisSet& reduction_axes, const AxisSet& reduction_axes,
const bool bessel_correction = false); const bool bessel_correction = false);
...@@ -129,6 +132,7 @@ namespace ngraph ...@@ -129,6 +132,7 @@ 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. | /// | \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 // clang-format on
NGRAPH_API
std::shared_ptr<Node> variance(const Output<Node>& value, std::shared_ptr<Node> variance(const Output<Node>& value,
const AxisSet& reduction_axes, const AxisSet& reduction_axes,
const bool bessel_correction = false); const bool bessel_correction = false);
...@@ -158,6 +162,7 @@ namespace ngraph ...@@ -158,6 +162,7 @@ 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. | /// | \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 // clang-format on
NGRAPH_API
std::shared_ptr<Node> mean(const Output<Node>& node, std::shared_ptr<Node> mean(const Output<Node>& node,
const AxisSet& reduction_axes, const AxisSet& reduction_axes,
bool keep_dims = false); bool keep_dims = false);
...@@ -189,6 +194,7 @@ namespace ngraph ...@@ -189,6 +194,7 @@ 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. | /// | \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 // clang-format on
NGRAPH_API
std::shared_ptr<Node> variance(const Output<Node>& value, std::shared_ptr<Node> variance(const Output<Node>& value,
const AxisSet& reduction_axes, const AxisSet& reduction_axes,
const bool bessel_correction = false); const bool bessel_correction = false);
......
...@@ -58,6 +58,7 @@ namespace ngraph ...@@ -58,6 +58,7 @@ namespace ngraph
/// \param axis The axis dividing shape. /// \param axis The axis dividing shape.
/// ///
/// \return The new value will be a 2D matrix representing the flattened input node. /// \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); std::shared_ptr<Node> flatten(const Output<Node>& value, int axis);
/// \brief Flatten a value into a 2D matrix, with a dynamic dividing axis. /// \brief Flatten a value into a 2D matrix, with a dynamic dividing axis.
...@@ -67,6 +68,7 @@ namespace ngraph ...@@ -67,6 +68,7 @@ namespace ngraph
/// to the shape (1,). /// to the shape (1,).
/// ///
/// \return The new value will be a 2D matrix representing the flattened input node. /// \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, const Output<Node>& axis); std::shared_ptr<Node> flatten(const Output<Node>& value, const Output<Node>& axis);
/// \brief Remove empty axes from input tensor. /// \brief Remove empty axes from input tensor.
......
...@@ -39,7 +39,7 @@ namespace ngraph ...@@ -39,7 +39,7 @@ namespace ngraph
}; };
/// Base class for check failure exceptions. /// Base class for check failure exceptions.
class CheckFailure : public ngraph_error class NGRAPH_API CheckFailure : public ngraph_error
{ {
public: public:
CheckFailure(const CheckLocInfo& check_loc_info, CheckFailure(const CheckLocInfo& check_loc_info,
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <ngraph/ngraph_visibility.hpp>
namespace ngraph namespace ngraph
{ {
namespace event namespace event
...@@ -99,7 +101,7 @@ private: ...@@ -99,7 +101,7 @@ private:
static bool s_tracing_enabled; static bool s_tracing_enabled;
}; };
class ngraph::event::Duration class NGRAPH_API ngraph::event::Duration
{ {
public: public:
explicit Duration(const std::string& name, explicit Duration(const std::string& name,
......
...@@ -69,5 +69,6 @@ namespace ngraph ...@@ -69,5 +69,6 @@ namespace ngraph
void set(const std::vector<uint64_t>& value) override; void set(const std::vector<uint64_t>& value) override;
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const Coordinate& coordinate); std::ostream& operator<<(std::ostream& s, const Coordinate& coordinate);
} }
...@@ -68,5 +68,6 @@ namespace ngraph ...@@ -68,5 +68,6 @@ namespace ngraph
void set(const std::vector<int64_t>& value) override; void set(const std::vector<int64_t>& value) override;
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const CoordinateDiff& coordinate_diff); std::ostream& operator<<(std::ostream& s, const CoordinateDiff& coordinate_diff);
} }
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <ngraph/ngraph_visibility.hpp>
// The CPIO file format can be found at // The CPIO file format can be found at
// https://www.mkssoftware.com/docs/man4/cpio.4.asp // https://www.mkssoftware.com/docs/man4/cpio.4.asp
...@@ -59,7 +61,7 @@ public: ...@@ -59,7 +61,7 @@ public:
private: private:
}; };
class ngraph::cpio::FileInfo class NGRAPH_API ngraph::cpio::FileInfo
{ {
public: public:
FileInfo(const std::string& name, size_t size, size_t offset) FileInfo(const std::string& name, size_t size, size_t offset)
...@@ -78,7 +80,7 @@ private: ...@@ -78,7 +80,7 @@ private:
size_t m_offset; size_t m_offset;
}; };
class ngraph::cpio::Writer class NGRAPH_API ngraph::cpio::Writer
{ {
public: public:
Writer(); Writer();
...@@ -95,7 +97,7 @@ private: ...@@ -95,7 +97,7 @@ private:
std::ofstream m_my_stream; std::ofstream m_my_stream;
}; };
class ngraph::cpio::Reader class NGRAPH_API ngraph::cpio::Reader
{ {
public: public:
Reader(); Reader();
......
...@@ -84,6 +84,7 @@ namespace ngraph ...@@ -84,6 +84,7 @@ namespace ngraph
size_t m_pool_offset{0}; size_t m_pool_offset{0};
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream&, const ngraph::descriptor::Tensor&); std::ostream& operator<<(std::ostream&, const ngraph::descriptor::Tensor&);
} }
} }
...@@ -172,5 +172,6 @@ namespace ngraph ...@@ -172,5 +172,6 @@ namespace ngraph
/// \return A reference to `str` after insertion. /// \return A reference to `str` after insertion.
/// ///
/// Inserts the string `?` if `dimension` is dynamic; else inserts `int64_t(dimension)`. /// Inserts the string `?` if `dimension` is dynamic; else inserts `int64_t(dimension)`.
NGRAPH_API
std::ostream& operator<<(std::ostream& str, const Dimension& dimension); std::ostream& operator<<(std::ostream& str, const Dimension& dimension);
} }
...@@ -36,11 +36,13 @@ namespace ngraph ...@@ -36,11 +36,13 @@ namespace ngraph
MAX, MAX,
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& out, const Type& obj); std::ostream& operator<<(std::ostream& out, const Type& obj);
} }
template <> template <>
class AttributeAdapter<reduction::Type> : public EnumAttributeAdapterBase<reduction::Type> class NGRAPH_API AttributeAdapter<reduction::Type>
: public EnumAttributeAdapterBase<reduction::Type>
{ {
public: public:
AttributeAdapter(reduction::Type& value) AttributeAdapter(reduction::Type& value)
...@@ -48,7 +50,6 @@ namespace ngraph ...@@ -48,7 +50,6 @@ namespace ngraph
{ {
} }
NGRAPH_API
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<reduction::Type>", 0}; static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<reduction::Type>", 0};
const DiscreteTypeInfo& get_type_info() const override { return type_info; } const DiscreteTypeInfo& get_type_info() const override { return type_info; }
}; };
...@@ -74,5 +75,7 @@ namespace ngraph ...@@ -74,5 +75,7 @@ namespace ngraph
}; };
void set_distributed_interface(std::unique_ptr<DistributedInterface> distributed_interface); void set_distributed_interface(std::unique_ptr<DistributedInterface> distributed_interface);
NGRAPH_API
DistributedInterface* get_distributed_interface(); DistributedInterface* get_distributed_interface();
} }
...@@ -18,12 +18,15 @@ ...@@ -18,12 +18,15 @@
#include <string> #include <string>
#include <ngraph/ngraph_visibility.hpp>
namespace ngraph namespace ngraph
{ {
/// \brief Get the names environment variable as a string. /// \brief Get the names environment variable as a string.
/// \param env_var The string name of the environment variable to get. /// \param env_var The string name of the environment variable to get.
/// \return Returns string by value or an empty string if the environment /// \return Returns string by value or an empty string if the environment
/// variable is not set. /// variable is not set.
NGRAPH_API
std::string getenv_string(const char* env_var); std::string getenv_string(const char* env_var);
/// \brief Get the names environment variable as an integer. If the value is not a /// \brief Get the names environment variable as an integer. If the value is not a
...@@ -31,6 +34,7 @@ namespace ngraph ...@@ -31,6 +34,7 @@ namespace ngraph
/// \param env_var The string name of the environment variable to get. /// \param env_var The string name of the environment variable to get.
/// \param default_value The value to return if the environment variable is not set. /// \param default_value The value to return if the environment variable is not set.
/// \return Returns value or default_value if the environment variable is not set. /// \return Returns value or default_value if the environment variable is not set.
NGRAPH_API
int32_t getenv_int(const char* env_var, int32_t default_value = -1); int32_t getenv_int(const char* env_var, int32_t default_value = -1);
/// \brief Get the names environment variable as a boolean. If the value is not a /// \brief Get the names environment variable as a boolean. If the value is not a
...@@ -41,5 +45,6 @@ namespace ngraph ...@@ -41,5 +45,6 @@ namespace ngraph
/// \param env_var The string name of the environment variable to get. /// \param env_var The string name of the environment variable to get.
/// \param default_value The value to return if the environment variable is not set. /// \param default_value The value to return if the environment variable is not set.
/// \return Returns the boolean value of the environment variable. /// \return Returns the boolean value of the environment variable.
NGRAPH_API
bool getenv_bool(const char* env_var, bool default_value = false); bool getenv_bool(const char* env_var, bool default_value = false);
} }
...@@ -19,10 +19,12 @@ ...@@ -19,10 +19,12 @@
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <ngraph/ngraph_visibility.hpp>
namespace ngraph namespace ngraph
{ {
/// Base error for ngraph runtime errors. /// Base error for ngraph runtime errors.
class ngraph_error : public std::runtime_error class NGRAPH_API ngraph_error : public std::runtime_error
{ {
public: public:
explicit ngraph_error(const std::string& what_arg) explicit ngraph_error(const std::string& what_arg)
...@@ -41,7 +43,7 @@ namespace ngraph ...@@ -41,7 +43,7 @@ namespace ngraph
} }
}; };
class unsupported_op : public std::runtime_error class NGRAPH_API unsupported_op : public std::runtime_error
{ {
public: public:
unsupported_op(const std::string& what_arg) unsupported_op(const std::string& what_arg)
......
...@@ -20,27 +20,35 @@ ...@@ -20,27 +20,35 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <ngraph/ngraph_visibility.hpp>
namespace ngraph namespace ngraph
{ {
namespace file_util namespace file_util
{ {
/// \brief Returns the name with extension for a given path /// \brief Returns the name with extension for a given path
/// \param path The path to the output file /// \param path The path to the output file
NGRAPH_API
std::string get_file_name(const std::string& path); std::string get_file_name(const std::string& path);
/// \brief Returns the file extension /// \brief Returns the file extension
/// \param path The path to the output file /// \param path The path to the output file
NGRAPH_API
std::string get_file_ext(const std::string& path); std::string get_file_ext(const std::string& path);
/// \brief Returns the directory portion of the given path /// \brief Returns the directory portion of the given path
/// \param path The path to the output file /// \param path The path to the output file
NGRAPH_API
std::string get_directory(const std::string& path); std::string get_directory(const std::string& path);
/// \brief Joins multiple paths into a single path /// \brief Joins multiple paths into a single path
/// \param s1 Left side of path /// \param s1 Left side of path
/// \param s2 Right side of path /// \param s2 Right side of path
NGRAPH_API
std::string path_join(const std::string& s1, const std::string& s2); std::string path_join(const std::string& s1, const std::string& s2);
NGRAPH_API
std::string path_join(const std::string& s1, const std::string& s2, const std::string& s3); std::string path_join(const std::string& s1, const std::string& s2, const std::string& s3);
NGRAPH_API
std::string path_join(const std::string& s1, std::string path_join(const std::string& s1,
const std::string& s2, const std::string& s2,
const std::string& s3, const std::string& s3,
...@@ -48,39 +56,47 @@ namespace ngraph ...@@ -48,39 +56,47 @@ namespace ngraph
/// \brief Returns the size in bytes of filename /// \brief Returns the size in bytes of filename
/// \param filename The name of the file /// \param filename The name of the file
NGRAPH_API
size_t get_file_size(const std::string& filename); size_t get_file_size(const std::string& filename);
/// \brief Removes all files and directories starting at dir /// \brief Removes all files and directories starting at dir
/// \param dir The path of the directory to remove /// \param dir The path of the directory to remove
NGRAPH_API
void remove_directory(const std::string& dir); void remove_directory(const std::string& dir);
/// \brief Create a directory /// \brief Create a directory
/// \param dir Path of the directory to create /// \param dir Path of the directory to create
/// \return true if the directory was created, false otherwise /// \return true if the directory was created, false otherwise
NGRAPH_API
bool make_directory(const std::string& dir); bool make_directory(const std::string& dir);
/// \brief Gets the path of the system temporary directory /// \brief Gets the path of the system temporary directory
/// \return the path to the system temporary directory /// \return the path to the system temporary directory
NGRAPH_API
std::string get_temp_directory_path(); std::string get_temp_directory_path();
/// \brief Removes a file from the filesystem /// \brief Removes a file from the filesystem
/// \param file The path to the file to be removed /// \param file The path to the file to be removed
NGRAPH_API
void remove_file(const std::string& file); void remove_file(const std::string& file);
/// \brief Reads the contents of a file /// \brief Reads the contents of a file
/// \param path The path of the file to read /// \param path The path of the file to read
/// \return vector<char> of the file's contents /// \return vector<char> of the file's contents
NGRAPH_API
std::vector<char> read_file_contents(const std::string& path); std::vector<char> read_file_contents(const std::string& path);
/// \brief Reads the contents of a file /// \brief Reads the contents of a file
/// \param path The path of the file to read /// \param path The path of the file to read
/// \return string of the file's contents /// \return string of the file's contents
NGRAPH_API
std::string read_file_to_string(const std::string& path); std::string read_file_to_string(const std::string& path);
/// \brief Iterate through files and optionally directories. Symbolic links are skipped. /// \brief Iterate through files and optionally directories. Symbolic links are skipped.
/// \param path The path to iterate over /// \param path The path to iterate over
/// \param func A callback function called with each file or directory encountered /// \param func A callback function called with each file or directory encountered
/// \param recurse Optional parameter to enable recursing through path /// \param recurse Optional parameter to enable recursing through path
NGRAPH_API
void iterate_files(const std::string& path, void iterate_files(const std::string& path,
std::function<void(const std::string& file, bool is_dir)> func, std::function<void(const std::string& file, bool is_dir)> func,
bool recurse = false, bool recurse = false,
...@@ -89,11 +105,13 @@ namespace ngraph ...@@ -89,11 +105,13 @@ namespace ngraph
/// \brief Create a temporary file /// \brief Create a temporary file
/// \param extension Optional extension for the temporary file /// \param extension Optional extension for the temporary file
/// \return Name of the temporary file /// \return Name of the temporary file
NGRAPH_API
std::string tmp_filename(const std::string& extension = ""); std::string tmp_filename(const std::string& extension = "");
/// \brief Test for the existence of a path or file /// \brief Test for the existence of a path or file
/// \param path The path to test /// \param path The path to test
/// \return true if the path exists, false otherwise /// \return true if the path exists, false otherwise
NGRAPH_API
bool exists(const std::string& path); bool exists(const std::string& path);
} }
} }
...@@ -51,7 +51,7 @@ namespace ngraph ...@@ -51,7 +51,7 @@ namespace ngraph
// forward declaration // forward declaration
class Graph; class Graph;
class Node class NGRAPH_API Node
{ {
public: public:
Node() = delete; Node() = delete;
......
...@@ -47,9 +47,11 @@ namespace ngraph ...@@ -47,9 +47,11 @@ namespace ngraph
} }
} }
NGRAPH_API
void traverse_nodes(const std::shared_ptr<const Function> p, void traverse_nodes(const std::shared_ptr<const Function> p,
std::function<void(std::shared_ptr<Node>)> f); std::function<void(std::shared_ptr<Node>)> f);
NGRAPH_API
void traverse_nodes(const Function* p, std::function<void(std::shared_ptr<Node>)> f); void traverse_nodes(const Function* p, std::function<void(std::shared_ptr<Node>)> f);
/// \brief Visit each node in a sub-graph of the entire graph /// \brief Visit each node in a sub-graph of the entire graph
...@@ -64,16 +66,19 @@ namespace ngraph ...@@ -64,16 +66,19 @@ namespace ngraph
/// Most useful for finding parameters of a graph directly from the /// Most useful for finding parameters of a graph directly from the
/// result nodes and not from function parameters or extracting a /// result nodes and not from function parameters or extracting a
/// subgraph relevant to the computation of certain outputs /// subgraph relevant to the computation of certain outputs
NGRAPH_API
void traverse_nodes(const NodeVector& subgraph_results, void traverse_nodes(const NodeVector& subgraph_results,
std::function<void(std::shared_ptr<Node>)> f, std::function<void(std::shared_ptr<Node>)> f,
const NodeVector& subgraph_params = {}); const NodeVector& subgraph_params = {});
NGRAPH_API
void traverse_nodes(const NodeVector& subgraph_results, void traverse_nodes(const NodeVector& subgraph_results,
std::function<void(std::shared_ptr<Node>)> f, std::function<void(std::shared_ptr<Node>)> f,
bool, bool,
const NodeVector& subgraph_params = {}) const NodeVector& subgraph_params = {})
NGRAPH_DEPRECATED("Use traverse_nodes without control-deps option"); NGRAPH_DEPRECATED("Use traverse_nodes without control-deps option");
NGRAPH_API
void traverse_functions(std::shared_ptr<Function> p, void traverse_functions(std::shared_ptr<Function> p,
std::function<void(std::shared_ptr<Function>)> f) std::function<void(std::shared_ptr<Function>)> f)
NGRAPH_DEPRECATED("Replace with f(p)"); NGRAPH_DEPRECATED("Replace with f(p)");
...@@ -247,6 +252,7 @@ namespace ngraph ...@@ -247,6 +252,7 @@ namespace ngraph
/// bound by `f`, it will be silently ignored.) /// bound by `f`, it will be silently ignored.)
/// - If a parameter node appears as a key in both `parameter_replacement_map` _and_ in /// - If a parameter node appears as a key in both `parameter_replacement_map` _and_ in
/// `body_replacement_map`, behavior is unspecified. /// `body_replacement_map`, behavior is unspecified.
NGRAPH_API
void replace_nodes( void replace_nodes(
const std::shared_ptr<Function>& f, const std::shared_ptr<Function>& f,
const std::unordered_map<std::shared_ptr<op::v0::Parameter>, const std::unordered_map<std::shared_ptr<op::v0::Parameter>,
...@@ -254,6 +260,7 @@ namespace ngraph ...@@ -254,6 +260,7 @@ namespace ngraph
const std::unordered_map<std::shared_ptr<Node>, std::shared_ptr<Node>>& const std::unordered_map<std::shared_ptr<Node>, std::shared_ptr<Node>>&
body_replacement_map); body_replacement_map);
NGRAPH_API
NodeVector find_common_args(std::shared_ptr<Node> target, std::shared_ptr<Node> replacement); NodeVector find_common_args(std::shared_ptr<Node> target, std::shared_ptr<Node> replacement);
/// Topological sort of nodes needed to compute root_nodes /// Topological sort of nodes needed to compute root_nodes
...@@ -379,19 +386,23 @@ namespace ngraph ...@@ -379,19 +386,23 @@ namespace ngraph
} }
// Check if all paths from X to a result go through Y // Check if all paths from X to a result go through Y
NGRAPH_API
bool is_post_dominated(Node* X, Node* Y); bool is_post_dominated(Node* X, Node* Y);
NGRAPH_API
bool is_equal_to_const_value(std::string const_value, const Output<Node>& reduce_constant); bool is_equal_to_const_value(std::string const_value, const Output<Node>& reduce_constant);
// input nodes are cloned and returned // input nodes are cloned and returned
// NodeMap input may contain default node mapping i.e. pre-cloned nodes // NodeMap input may contain default node mapping i.e. pre-cloned nodes
// NodeMap output (by reference) fully maps input and cloned nodes // NodeMap output (by reference) fully maps input and cloned nodes
NGRAPH_API
std::vector<std::shared_ptr<ngraph::Node>> std::vector<std::shared_ptr<ngraph::Node>>
clone_nodes(const std::vector<std::shared_ptr<ngraph::Node>>& nodes, NodeMap& node_map); clone_nodes(const std::vector<std::shared_ptr<ngraph::Node>>& nodes, NodeMap& node_map);
// input nodes are cloned and returned // input nodes are cloned and returned
// NodeMap input may contain default node mapping i.e. pre-cloned nodes // NodeMap input may contain default node mapping i.e. pre-cloned nodes
// NodeMap output (by reference) fully maps input and cloned nodes // NodeMap output (by reference) fully maps input and cloned nodes
NGRAPH_API
std::list<std::shared_ptr<ngraph::Node>> std::list<std::shared_ptr<ngraph::Node>>
clone_nodes(const std::vector<std::shared_ptr<ngraph::Node>>& nodes, clone_nodes(const std::vector<std::shared_ptr<ngraph::Node>>& nodes,
RawNodeOutputMap& node_map); RawNodeOutputMap& node_map);
...@@ -399,31 +410,40 @@ namespace ngraph ...@@ -399,31 +410,40 @@ namespace ngraph
// input function is cloned and returned // input function is cloned and returned
// NodeMap input may contain default node mapping i.e. pre-cloned nodes // NodeMap input may contain default node mapping i.e. pre-cloned nodes
// NodeMap output (by reference) fully maps input and cloned function ops // NodeMap output (by reference) fully maps input and cloned function ops
NGRAPH_API
std::shared_ptr<ngraph::Function> clone_function(const ngraph::Function& func, std::shared_ptr<ngraph::Function> clone_function(const ngraph::Function& func,
NodeMap& node_map); NodeMap& node_map);
// input function is cloned and returned // input function is cloned and returned
NGRAPH_API
std::shared_ptr<ngraph::Function> clone_function(const ngraph::Function& func); std::shared_ptr<ngraph::Function> clone_function(const ngraph::Function& func);
// Assert that nodes in the function is colocated and return that placement // Assert that nodes in the function is colocated and return that placement
NGRAPH_API
Placement get_colocated_function_placement(std::shared_ptr<Function> func); Placement get_colocated_function_placement(std::shared_ptr<Function> func);
NGRAPH_API
std::pair<std::shared_ptr<op::Result>, std::shared_ptr<op::v0::Parameter>> std::pair<std::shared_ptr<op::Result>, std::shared_ptr<op::v0::Parameter>>
insert_result_parameter_split(const std::shared_ptr<Node>& src_node, insert_result_parameter_split(const std::shared_ptr<Node>& src_node,
const std::shared_ptr<Node>& dst_node); const std::shared_ptr<Node>& dst_node);
NGRAPH_API
void insert_new_node_between(const std::shared_ptr<Node>& src_node, void insert_new_node_between(const std::shared_ptr<Node>& src_node,
const std::shared_ptr<Node>& dst_node, const std::shared_ptr<Node>& dst_node,
const std::shared_ptr<Node>& new_node); const std::shared_ptr<Node>& new_node);
NGRAPH_API
std::shared_ptr<Node> make_zero(const element::Type& element_type, const Shape& shape); std::shared_ptr<Node> make_zero(const element::Type& element_type, const Shape& shape);
NGRAPH_API
std::shared_ptr<Node> make_constant_from_string(std::string val, std::shared_ptr<Node> make_constant_from_string(std::string val,
const element::Type& element_type, const element::Type& element_type,
const Shape& shape); const Shape& shape);
NGRAPH_API
bool is_zero(const Output<Node>& reduce_constant); bool is_zero(const Output<Node>& reduce_constant);
NGRAPH_API
NodeVector get_subgraph_outputs(const NodeVector& nodes, NodeVector get_subgraph_outputs(const NodeVector& nodes,
const NodeVector& exclusions, const NodeVector& exclusions,
bool ignore_unused = false, bool ignore_unused = false,
...@@ -432,27 +452,36 @@ namespace ngraph ...@@ -432,27 +452,36 @@ namespace ngraph
// Extract sub-graph computing the `results`. Stops backward traversal at either a Parameter // Extract sub-graph computing the `results`. Stops backward traversal at either a Parameter
// node // node
// or a node that belongs to args // or a node that belongs to args
NGRAPH_API
NodeVector extract_subgraph(const NodeVector& results, const NodeVector& args); NodeVector extract_subgraph(const NodeVector& results, const NodeVector& args);
NGRAPH_API
bool is_one(const Output<Node>& reduce_constant); bool is_one(const Output<Node>& reduce_constant);
NGRAPH_API
bool compare_constants(const std::shared_ptr<Node>& n1, const std::shared_ptr<Node>& n2); bool compare_constants(const std::shared_ptr<Node>& n1, const std::shared_ptr<Node>& n2);
// Returns true if `node` is live in the graph i.e. a result op // Returns true if `node` is live in the graph i.e. a result op
// transitively uses this `node` // transitively uses this `node`
NGRAPH_API
bool is_used(Node* node); bool is_used(Node* node);
// Returns count of `node` users that are still live in the graph // Returns count of `node` users that are still live in the graph
NGRAPH_API
size_t get_user_count(Node* node); size_t get_user_count(Node* node);
// Return true if a node's user could potentially overwrite // Return true if a node's user could potentially overwrite
// the output of this node with in-place kernels // the output of this node with in-place kernels
NGRAPH_API
bool possibly_overwritten(Node* node); bool possibly_overwritten(Node* node);
NGRAPH_API
bool is_strided(const Strides& strides); bool is_strided(const Strides& strides);
NGRAPH_API
bool is_valid_rank(const std::shared_ptr<Node>& node, std::vector<size_t> valid_ranks); bool is_valid_rank(const std::shared_ptr<Node>& node, std::vector<size_t> valid_ranks);
NGRAPH_API
void plot_graph( void plot_graph(
std::shared_ptr<Function> f, std::shared_ptr<Function> f,
const std::string& filename, const std::string& filename,
...@@ -460,14 +489,17 @@ namespace ngraph ...@@ -460,14 +489,17 @@ namespace ngraph
/// \return A vector containing handles for each input of dst that is connected to an output /// \return A vector containing handles for each input of dst that is connected to an output
/// of `src`. /// of `src`.
NGRAPH_API
std::vector<Input<Node>> get_inputs_from(Node& src, Node& dst); std::vector<Input<Node>> get_inputs_from(Node& src, Node& dst);
/// \return A vector containing a handle for each output of src that is connected to an input /// \return A vector containing a handle for each output of src that is connected to an input
/// of `dst`. /// of `dst`.
NGRAPH_API
std::vector<Output<Node>> get_outputs_to(Node& src, Node& dst); std::vector<Output<Node>> get_outputs_to(Node& src, Node& dst);
/// Checks the func for graph cycles starting from results going backwards, then from parameters /// Checks the func for graph cycles starting from results going backwards, then from parameters
/// going forward. /// going forward.
/// It returns true if a cycle is found and the first cycle encountered. /// It returns true if a cycle is found and the first cycle encountered.
NGRAPH_API
bool check_for_cycles(const ngraph::Function* func, bool check_for_cycles(const ngraph::Function* func,
ngraph::NodeVector& cycle_nodes, ngraph::NodeVector& cycle_nodes,
bool& is_bkwd_cycle); bool& is_bkwd_cycle);
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#endif #endif
#include <vector> #include <vector>
#include <ngraph/ngraph_visibility.hpp>
namespace ngraph namespace ngraph
{ {
class ConstString class ConstString
...@@ -77,7 +79,7 @@ namespace ngraph ...@@ -77,7 +79,7 @@ namespace ngraph
_LOG_TYPE_DEBUG, _LOG_TYPE_DEBUG,
}; };
class LogHelper class NGRAPH_API LogHelper
{ {
public: public:
LogHelper(LOG_TYPE, LogHelper(LOG_TYPE,
...@@ -109,6 +111,7 @@ namespace ngraph ...@@ -109,6 +111,7 @@ namespace ngraph
static std::deque<std::string> m_queue; static std::deque<std::string> m_queue;
}; };
NGRAPH_API
void default_logger_handler_func(const std::string& s); void default_logger_handler_func(const std::string& s);
#define NGRAPH_ERR \ #define NGRAPH_ERR \
......
...@@ -20,14 +20,14 @@ ...@@ -20,14 +20,14 @@
using namespace std; using namespace std;
extern "C" const char* get_ngraph_version_string() extern "C" NGRAPH_API const char* get_ngraph_version_string()
{ {
return NGRAPH_VERSION; return NGRAPH_VERSION;
} }
namespace ngraph namespace ngraph
{ {
void get_version(size_t& major, size_t& minor, size_t& patch, std::string& extra) NGRAPH_API void get_version(size_t& major, size_t& minor, size_t& patch, std::string& extra)
{ {
string version = NGRAPH_VERSION; string version = NGRAPH_VERSION;
ngraph::parse_version_string(version, major, minor, patch, extra); ngraph::parse_version_string(version, major, minor, patch, extra);
......
...@@ -26,7 +26,10 @@ ...@@ -26,7 +26,10 @@
#error("ngraph.hpp is for external use only") #error("ngraph.hpp is for external use only")
#endif #endif
extern "C" const char* get_ngraph_version_string(); #include <ngraph/ngraph_visibility.hpp>
extern "C" NGRAPH_API const char* get_ngraph_version_string();
namespace ngraph namespace ngraph
{ {
/// \brief Function to query parsed version information of the version of ngraph which /// \brief Function to query parsed version information of the version of ngraph which
...@@ -39,6 +42,7 @@ namespace ngraph ...@@ -39,6 +42,7 @@ namespace ngraph
/// the patch version number. /// the patch version number.
/// ///
/// \note Throws a runtime_error if there is an error during parsing /// \note Throws a runtime_error if there is an error during parsing
NGRAPH_API
void get_version(size_t& major, size_t& minor, size_t& patch, std::string& extra); void get_version(size_t& major, size_t& minor, size_t& patch, std::string& extra);
} }
......
...@@ -95,6 +95,7 @@ namespace ngraph ...@@ -95,6 +95,7 @@ namespace ngraph
NGRAPH_API NGRAPH_API
OutputVector as_output_vector(const NodeVector& args); OutputVector as_output_vector(const NodeVector& args);
NGRAPH_API
NodeVector as_node_vector(const OutputVector& values); NodeVector as_node_vector(const OutputVector& values);
/// Returns a ResultVector referencing values. /// Returns a ResultVector referencing values.
ResultVector as_result_vector(const OutputVector& values); ResultVector as_result_vector(const OutputVector& values);
...@@ -583,7 +584,7 @@ namespace ngraph ...@@ -583,7 +584,7 @@ namespace ngraph
using RawNodeOutputMap = std::map<RawNodeOutput, Output<Node>>; using RawNodeOutputMap = std::map<RawNodeOutput, Output<Node>>;
class NodeValidationFailure : public CheckFailure class NGRAPH_API NodeValidationFailure : public CheckFailure
{ {
public: public:
NodeValidationFailure(const CheckLocInfo& check_loc_info, NodeValidationFailure(const CheckLocInfo& check_loc_info,
......
...@@ -37,7 +37,7 @@ namespace ngraph ...@@ -37,7 +37,7 @@ namespace ngraph
/// \brief A handle for one of a node's inputs. /// \brief A handle for one of a node's inputs.
template <> template <>
class Input<Node> class NGRAPH_API Input<Node>
{ {
public: public:
/// \brief Constructs a Input. /// \brief Constructs a Input.
......
...@@ -115,6 +115,7 @@ namespace ngraph ...@@ -115,6 +115,7 @@ namespace ngraph
} }
} // namespace op } // namespace op
NGRAPH_API
std::ostream& operator<<(std::ostream& s, std::ostream& operator<<(std::ostream& s,
const op::v1::BinaryConvolution::BinaryConvolutionMode& type); const op::v1::BinaryConvolution::BinaryConvolutionMode& type);
......
...@@ -25,10 +25,9 @@ namespace ngraph ...@@ -25,10 +25,9 @@ namespace ngraph
namespace v1 namespace v1
{ {
/// \brief Elementwise type conversion operation. /// \brief Elementwise type conversion operation.
class ConvertLike : public Op class NGRAPH_API ConvertLike : public Op
{ {
public: public:
NGRAPH_API
static constexpr NodeTypeInfo type_info{"ConvertLike", 1}; static constexpr NodeTypeInfo type_info{"ConvertLike", 1};
const NodeTypeInfo& get_type_info() const override { return type_info; } const NodeTypeInfo& get_type_info() const override { return type_info; }
/// \brief Constructs a conversion operation. /// \brief Constructs a conversion operation.
......
...@@ -120,5 +120,6 @@ namespace ngraph ...@@ -120,5 +120,6 @@ namespace ngraph
using v0::Divide; using v0::Divide;
} // namespace op } // namespace op
NGRAPH_API
std::shared_ptr<Node> operator/(const Output<Node>& arg0, const Output<Node>& arg1); std::shared_ptr<Node> operator/(const Output<Node>& arg0, const Output<Node>& arg1);
} // namespace ngraph } // namespace ngraph
...@@ -79,6 +79,8 @@ namespace ngraph ...@@ -79,6 +79,8 @@ namespace ngraph
} }
using v0::DepthToSpace; using v0::DepthToSpace;
} }
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const op::v0::DepthToSpace::DepthToSpaceMode& type); std::ostream& operator<<(std::ostream& s, const op::v0::DepthToSpace::DepthToSpaceMode& type);
template <> template <>
......
...@@ -286,6 +286,7 @@ namespace ngraph ...@@ -286,6 +286,7 @@ namespace ngraph
using v0::LSTMCell; using v0::LSTMCell;
} // namespace op } // namespace op
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const op::LSTMWeightsFormat& type); std::ostream& operator<<(std::ostream& s, const op::LSTMWeightsFormat& type);
template <> template <>
......
...@@ -187,6 +187,7 @@ namespace ngraph ...@@ -187,6 +187,7 @@ namespace ngraph
using v0::LSTMSequence; using v0::LSTMSequence;
} // namespace op } // namespace op
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const op::v0::LSTMSequence::direction& type); std::ostream& operator<<(std::ostream& s, const op::v0::LSTMSequence::direction& type);
template <> template <>
......
...@@ -77,6 +77,7 @@ namespace ngraph ...@@ -77,6 +77,7 @@ namespace ngraph
using v0::SpaceToDepth; using v0::SpaceToDepth;
} // namespace op } // namespace op
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const op::v0::SpaceToDepth::SpaceToDepthMode& type); std::ostream& operator<<(std::ostream& s, const op::v0::SpaceToDepth::SpaceToDepthMode& type);
template <> template <>
......
...@@ -27,10 +27,9 @@ namespace ngraph ...@@ -27,10 +27,9 @@ namespace ngraph
namespace v0 namespace v0
{ {
/// \brief Operator performing Stack. /// \brief Operator performing Stack.
class Stack : public ngraph::op::util::FusedOp class NGRAPH_API Stack : public ngraph::op::util::FusedOp
{ {
public: public:
NGRAPH_API
static constexpr NodeTypeInfo type_info{"Stack", 0}; static constexpr NodeTypeInfo type_info{"Stack", 0};
const NodeTypeInfo& get_type_info() const override { return type_info; } const NodeTypeInfo& get_type_info() const override { return type_info; }
Stack() = default; Stack() = default;
......
...@@ -22,6 +22,7 @@ namespace ngraph ...@@ -22,6 +22,7 @@ namespace ngraph
{ {
namespace op namespace op
{ {
NGRAPH_API
NodeVector get_output_elements(const std::shared_ptr<Node>& mon); NodeVector get_output_elements(const std::shared_ptr<Node>& mon);
namespace v0 namespace v0
......
...@@ -95,6 +95,7 @@ namespace ngraph ...@@ -95,6 +95,7 @@ namespace ngraph
} }
} }
NGRAPH_API
std::ostream& operator<<(std::ostream& s, std::ostream& operator<<(std::ostream& s,
const op::v1::NonMaxSuppression::BoxEncodingType& type); const op::v1::NonMaxSuppression::BoxEncodingType& type);
......
...@@ -137,6 +137,7 @@ namespace ngraph ...@@ -137,6 +137,7 @@ namespace ngraph
using v0::Reverse; using v0::Reverse;
} }
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const op::v1::Reverse::Mode& type); std::ostream& operator<<(std::ostream& s, const op::v1::Reverse::Mode& type);
template <> template <>
......
...@@ -85,6 +85,8 @@ namespace ngraph ...@@ -85,6 +85,8 @@ namespace ngraph
using v0::Subtract; using v0::Subtract;
} // namespace op } // namespace op
NGRAPH_API
std::shared_ptr<ngraph::Node> operator-(const Output<ngraph::Node> arg0, std::shared_ptr<ngraph::Node> operator-(const Output<ngraph::Node> arg0,
const Output<ngraph::Node> arg1); const Output<ngraph::Node> arg1);
} // namespace ngraph } // namespace ngraph
...@@ -210,6 +210,7 @@ namespace ngraph ...@@ -210,6 +210,7 @@ namespace ngraph
using v0::TopK; using v0::TopK;
} // op } // op
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const op::v1::TopK::Mode& type); std::ostream& operator<<(std::ostream& s, const op::v1::TopK::Mode& type);
template <> template <>
......
...@@ -36,6 +36,7 @@ namespace ngraph ...@@ -36,6 +36,7 @@ namespace ngraph
SYMMETRIC SYMMETRIC
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const PadMode& type); std::ostream& operator<<(std::ostream& s, const PadMode& type);
} }
...@@ -76,6 +77,7 @@ namespace ngraph ...@@ -76,6 +77,7 @@ namespace ngraph
NOTSET = EXPLICIT, NOTSET = EXPLICIT,
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const PadType& type); std::ostream& operator<<(std::ostream& s, const PadType& type);
} }
...@@ -101,6 +103,7 @@ namespace ngraph ...@@ -101,6 +103,7 @@ namespace ngraph
CEIL = 1, CEIL = 1,
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const RoundingType& type); std::ostream& operator<<(std::ostream& s, const RoundingType& type);
} }
...@@ -166,6 +169,7 @@ namespace ngraph ...@@ -166,6 +169,7 @@ namespace ngraph
PDPD PDPD
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const AutoBroadcastType& type); std::ostream& operator<<(std::ostream& s, const AutoBroadcastType& type);
} }
...@@ -194,6 +198,7 @@ namespace ngraph ...@@ -194,6 +198,7 @@ namespace ngraph
MAX MAX
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const EpsMode& type); std::ostream& operator<<(std::ostream& s, const EpsMode& type);
} }
...@@ -221,6 +226,8 @@ namespace ngraph ...@@ -221,6 +226,8 @@ namespace ngraph
// Sort result based on element values // Sort result based on element values
SORT_VALUES, SORT_VALUES,
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const TopKSortType& type); std::ostream& operator<<(std::ostream& s, const TopKSortType& type);
} }
...@@ -280,15 +287,15 @@ namespace ngraph ...@@ -280,15 +287,15 @@ namespace ngraph
} }
template <> template <>
class AttributeAdapter<op::AutoBroadcastSpec> : public ValueReference<op::AutoBroadcastSpec>, class NGRAPH_API AttributeAdapter<op::AutoBroadcastSpec>
public ValueAccessor<void> : public ValueReference<op::AutoBroadcastSpec>, public ValueAccessor<void>
{ {
public: public:
AttributeAdapter(op::AutoBroadcastSpec& value) AttributeAdapter(op::AutoBroadcastSpec& value)
: ValueReference<op::AutoBroadcastSpec>(value) : ValueReference<op::AutoBroadcastSpec>(value)
{ {
} }
NGRAPH_API
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::AutoBroadcastSpec>", 0}; static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<op::AutoBroadcastSpec>", 0};
const DiscreteTypeInfo& get_type_info() const override { return type_info; } const DiscreteTypeInfo& get_type_info() const override { return type_info; }
}; };
......
...@@ -52,7 +52,6 @@ bool is_uniform_constant(const Input<Node>& input) ...@@ -52,7 +52,6 @@ bool is_uniform_constant(const Input<Node>& input)
return rc; return rc;
} }
extern template Shape ngraph::apply_permutation<Shape>(Shape input, AxisVector order);
template <typename T> template <typename T>
static shared_ptr<pattern::Matcher> static shared_ptr<pattern::Matcher>
create_binary_matcher(shared_ptr<pattern::op::Label> label, create_binary_matcher(shared_ptr<pattern::op::Label> label,
......
...@@ -32,7 +32,7 @@ namespace ngraph ...@@ -32,7 +32,7 @@ namespace ngraph
} }
} }
class ngraph::pass::MemoryLayout : public FunctionPass class NGRAPH_API ngraph::pass::MemoryLayout : public FunctionPass
{ {
public: public:
MemoryLayout(size_t alignment = 1, bool disable_memory_sharing = false); MemoryLayout(size_t alignment = 1, bool disable_memory_sharing = false);
...@@ -43,7 +43,7 @@ private: ...@@ -43,7 +43,7 @@ private:
bool m_disable_memory_sharing; bool m_disable_memory_sharing;
}; };
class ngraph::pass::MemoryManager class NGRAPH_API ngraph::pass::MemoryManager
{ {
public: public:
enum class block_state enum class block_state
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <map> #include <map>
#include <string> #include <string>
#include <ngraph/ngraph_visibility.hpp>
namespace ngraph namespace ngraph
{ {
namespace pass namespace pass
...@@ -27,7 +29,7 @@ namespace ngraph ...@@ -27,7 +29,7 @@ namespace ngraph
} }
} }
class ngraph::pass::PassConfig class NGRAPH_API ngraph::pass::PassConfig
{ {
public: public:
PassConfig(); PassConfig();
......
...@@ -35,9 +35,6 @@ ...@@ -35,9 +35,6 @@
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
extern template AxisVector ngraph::apply_permutation<AxisVector>(AxisVector input,
AxisVector order);
void pass::ReshapeElimination::construct_identity_reshape_pattern() void pass::ReshapeElimination::construct_identity_reshape_pattern()
{ {
Shape shape_op{3}; Shape shape_op{3};
......
...@@ -23,25 +23,11 @@ namespace ngraph ...@@ -23,25 +23,11 @@ namespace ngraph
{ {
namespace pass namespace pass
{ {
class NGRAPH_API ReshapeSinking : public ngraph::pass::FunctionPass class NGRAPH_API ReshapeSinking : public pass::FunctionPass
{ {
public: public:
ReshapeSinking() { set_property(PassProperty::REQUIRE_STATIC_SHAPE, true); } ReshapeSinking() { set_property(PassProperty::REQUIRE_STATIC_SHAPE, true); }
bool run_on_function(std::shared_ptr<ngraph::Function> function) override; bool run_on_function(std::shared_ptr<Function> function) override;
}; };
} }
} }
extern template ngraph::AxisVector
ngraph::apply_permutation<ngraph::AxisVector>(ngraph::AxisVector input,
ngraph::AxisVector order);
extern template ngraph::Coordinate
ngraph::apply_permutation<ngraph::Coordinate>(ngraph::Coordinate input,
ngraph::AxisVector order);
extern template ngraph::Strides
ngraph::apply_permutation<ngraph::Strides>(ngraph::Strides input, ngraph::AxisVector order);
extern template ngraph::Shape ngraph::apply_permutation<ngraph::Shape>(ngraph::Shape input,
ngraph::AxisVector order);
...@@ -184,7 +184,7 @@ namespace ngraph ...@@ -184,7 +184,7 @@ namespace ngraph
bool m_strict_mode{false}; bool m_strict_mode{false};
}; };
class RecurrentMatcher class NGRAPH_API RecurrentMatcher
{ {
public: public:
/// \brief Constructs a RecurrentMatcher object. Reccurent Matchers are used to match /// \brief Constructs a RecurrentMatcher object. Reccurent Matchers are used to match
......
...@@ -54,6 +54,7 @@ namespace ngraph ...@@ -54,6 +54,7 @@ namespace ngraph
using NodePredicate = std::function<bool(std::shared_ptr<Node>)>; using NodePredicate = std::function<bool(std::shared_ptr<Node>)>;
using ValuePredicate = std::function<bool(const Output<Node>& value)>; using ValuePredicate = std::function<bool(const Output<Node>& value)>;
NGRAPH_API
ValuePredicate as_value_predicate(NodePredicate pred); ValuePredicate as_value_predicate(NodePredicate pred);
class NGRAPH_API Pattern : public Node class NGRAPH_API Pattern : public Node
......
...@@ -20,9 +20,14 @@ ...@@ -20,9 +20,14 @@
#include "ngraph/env_util.hpp" #include "ngraph/env_util.hpp"
#include "ngraph/ngraph_visibility.hpp"
namespace ngraph namespace ngraph
{ {
static bool s_provenance_enabled = getenv_bool("NGRAPH_PROVENANCE_ENABLE"); static bool s_provenance_enabled = getenv_bool("NGRAPH_PROVENANCE_ENABLE");
NGRAPH_API
void set_provenance_enabled(bool enabled); void set_provenance_enabled(bool enabled);
NGRAPH_API
bool get_provenance_enabled(); bool get_provenance_enabled();
} }
...@@ -30,12 +30,13 @@ namespace ngraph ...@@ -30,12 +30,13 @@ namespace ngraph
class DefaultAllocator; class DefaultAllocator;
/// \brief Create a default allocator that calls into system /// \brief Create a default allocator that calls into system
/// allocation libraries /// allocation libraries
NGRAPH_API
ngraph::runtime::Allocator* get_default_allocator(); ngraph::runtime::Allocator* get_default_allocator();
} }
} }
/// \brief Abstract class for the allocator /// \brief Abstract class for the allocator
class ngraph::runtime::Allocator class NGRAPH_API ngraph::runtime::Allocator
{ {
public: public:
virtual ~Allocator() = 0; virtual ~Allocator() = 0;
......
...@@ -87,9 +87,6 @@ ...@@ -87,9 +87,6 @@
#include "ngraph/runtime/cpu/op/update_slice.hpp" #include "ngraph/runtime/cpu/op/update_slice.hpp"
#include "ngraph/util.hpp" #include "ngraph/util.hpp"
extern template ngraph::Shape ngraph::apply_permutation<ngraph::Shape>(ngraph::Shape input,
ngraph::AxisVector order);
static bool init_cblas_arg(std::shared_ptr<ngraph::Node> reshape, static bool init_cblas_arg(std::shared_ptr<ngraph::Node> reshape,
std::shared_ptr<ngraph::Node> arg, std::shared_ptr<ngraph::Node> arg,
bool& transpose_w, bool& transpose_w,
......
...@@ -40,7 +40,7 @@ namespace ngraph ...@@ -40,7 +40,7 @@ namespace ngraph
} }
} }
class ngraph::runtime::interpreter::INTBackend : public Backend class INTERPRETER_BACKEND_API ngraph::runtime::interpreter::INTBackend : public Backend
{ {
public: public:
INTBackend(); INTBackend();
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#ifdef INTERPRETER_USE_HYBRID #ifdef INTERPRETER_USE_HYBRID
#include "ngraph/runtime/hybrid/op/function_call.hpp" #include "ngraph/runtime/hybrid/op/function_call.hpp"
#endif #endif
#include "ngraph/runtime/interpreter/int_backend_visibility.hpp"
#include "ngraph/runtime/reference/abs.hpp" #include "ngraph/runtime/reference/abs.hpp"
#include "ngraph/runtime/reference/acos.hpp" #include "ngraph/runtime/reference/acos.hpp"
#include "ngraph/runtime/reference/add.hpp" #include "ngraph/runtime/reference/add.hpp"
...@@ -144,7 +145,7 @@ namespace ngraph ...@@ -144,7 +145,7 @@ namespace ngraph
} // namespace runtime } // namespace runtime
} // namespace ngraph } // namespace ngraph
class ngraph::runtime::interpreter::INTExecutable : public Executable class INTERPRETER_BACKEND_API ngraph::runtime::interpreter::INTExecutable : public Executable
{ {
friend class INTBackend; friend class INTBackend;
......
...@@ -28,6 +28,7 @@ namespace ngraph ...@@ -28,6 +28,7 @@ namespace ngraph
/// \param indent If 0 then there is no formatting applied and the resulting string is the /// \param indent If 0 then there is no formatting applied and the resulting string is the
/// most compact representation. If non-zero then the json string is formatted with the /// most compact representation. If non-zero then the json string is formatted with the
/// indent level specified. /// indent level specified.
NGRAPH_API
std::string serialize(std::shared_ptr<ngraph::Function> func, size_t indent = 0); std::string serialize(std::shared_ptr<ngraph::Function> func, size_t indent = 0);
/// \brief Serialize a Function to a json file /// \brief Serialize a Function to a json file
...@@ -36,6 +37,7 @@ namespace ngraph ...@@ -36,6 +37,7 @@ namespace ngraph
/// \param indent If 0 then there is no formatting applied and the resulting string is the /// \param indent If 0 then there is no formatting applied and the resulting string is the
/// most compact representation. If non-zero then the json string is formatted with the /// most compact representation. If non-zero then the json string is formatted with the
/// indent level specified. /// indent level specified.
NGRAPH_API
void serialize(const std::string& path, void serialize(const std::string& path,
std::shared_ptr<ngraph::Function> func, std::shared_ptr<ngraph::Function> func,
size_t indent = 0); size_t indent = 0);
...@@ -46,21 +48,26 @@ namespace ngraph ...@@ -46,21 +48,26 @@ namespace ngraph
/// \param indent If 0 then there is no formatting applied and the json is the /// \param indent If 0 then there is no formatting applied and the json is the
/// most compact representation. If non-zero then the json is formatted with the /// most compact representation. If non-zero then the json is formatted with the
/// indent level specified. /// indent level specified.
NGRAPH_API
void serialize(std::ostream& out, std::shared_ptr<ngraph::Function> func, size_t indent = 0); void serialize(std::ostream& out, std::shared_ptr<ngraph::Function> func, size_t indent = 0);
/// \brief Deserialize a Function /// \brief Deserialize a Function
/// \param in An isteam to the input data /// \param in An isteam to the input data
NGRAPH_API
std::shared_ptr<ngraph::Function> deserialize(std::istream& in); std::shared_ptr<ngraph::Function> deserialize(std::istream& in);
/// \brief Deserialize a Function /// \brief Deserialize a Function
/// \param str The json formatted string to deseriailze. /// \param str The json formatted string to deseriailze.
NGRAPH_API
std::shared_ptr<ngraph::Function> deserialize(const std::string& str); std::shared_ptr<ngraph::Function> deserialize(const std::string& str);
/// \brief If enabled adds output shapes to the serialized graph /// \brief If enabled adds output shapes to the serialized graph
/// \param enable Set to true to enable or false otherwise /// \param enable Set to true to enable or false otherwise
/// ///
/// Option may be enabled by setting the environment variable NGRAPH_SERIALIZER_OUTPUT_SHAPES /// Option may be enabled by setting the environment variable NGRAPH_SERIALIZER_OUTPUT_SHAPES
NGRAPH_API
void set_serialize_output_shapes(bool enable); void set_serialize_output_shapes(bool enable);
NGRAPH_API
bool get_serialize_output_shapes(); bool get_serialize_output_shapes();
class WithSerializeOutputShapesEnabled class WithSerializeOutputShapesEnabled
......
...@@ -37,7 +37,7 @@ namespace ngraph ...@@ -37,7 +37,7 @@ namespace ngraph
} }
template <> template <>
PartialShape project(const PartialShape& shape, const AxisSet& axes); NGRAPH_API PartialShape project(const PartialShape& shape, const AxisSet& axes);
// Removes some values from a vector of axis values // Removes some values from a vector of axis values
template <typename AXIS_VALUES> template <typename AXIS_VALUES>
...@@ -57,7 +57,7 @@ namespace ngraph ...@@ -57,7 +57,7 @@ namespace ngraph
} }
template <> template <>
PartialShape reduce(const PartialShape& shape, const AxisSet& deleted_axes); NGRAPH_API PartialShape reduce(const PartialShape& shape, const AxisSet& deleted_axes);
// TODO: check validity, i.e. that the new axis indices are all less than // TODO: check validity, i.e. that the new axis indices are all less than
// axis_values.size()+num_new_axes. // axis_values.size()+num_new_axes.
...@@ -101,8 +101,9 @@ namespace ngraph ...@@ -101,8 +101,9 @@ namespace ngraph
} }
template <> template <>
PartialShape inject_pairs(const PartialShape& shape, NGRAPH_API PartialShape
std::vector<std::pair<size_t, Dimension>> new_axis_pos_value_pairs); inject_pairs(const PartialShape& shape,
std::vector<std::pair<size_t, Dimension>> new_axis_pos_value_pairs);
// Add a new value at a particular axis position // Add a new value at a particular axis position
template <typename AXIS_VALUES, typename AXIS_VALUE> template <typename AXIS_VALUES, typename AXIS_VALUE>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
namespace ngraph namespace ngraph
{ {
class BernoulliRNGState : public State class NGRAPH_API BernoulliRNGState : public State
{ {
public: public:
BernoulliRNGState(unsigned int seed, double probability) BernoulliRNGState(unsigned int seed, double probability)
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#pragma once #pragma once
#include <ngraph/ngraph_visibility.hpp>
namespace ngraph namespace ngraph
{ {
class State class State
......
...@@ -65,5 +65,6 @@ namespace ngraph ...@@ -65,5 +65,6 @@ namespace ngraph
void set(const std::vector<int64_t>& value) override; void set(const std::vector<int64_t>& value) override;
}; };
NGRAPH_API
std::ostream& operator<<(std::ostream& s, const Strides& strides); std::ostream& operator<<(std::ostream& s, const Strides& strides);
} }
...@@ -108,7 +108,7 @@ namespace ngraph ...@@ -108,7 +108,7 @@ namespace ngraph
namespace std namespace std
{ {
template <> template <>
struct hash<ngraph::DiscreteTypeInfo> struct NGRAPH_API hash<ngraph::DiscreteTypeInfo>
{ {
size_t operator()(const ngraph::DiscreteTypeInfo& k) const; size_t operator()(const ngraph::DiscreteTypeInfo& k) const;
}; };
......
...@@ -90,7 +90,7 @@ namespace ngraph ...@@ -90,7 +90,7 @@ namespace ngraph
namespace std namespace std
{ {
bool isnan(ngraph::float16 x); bool NGRAPH_API isnan(ngraph::float16 x);
template <> template <>
class numeric_limits<ngraph::float16> class numeric_limits<ngraph::float16>
......
...@@ -49,6 +49,7 @@ namespace ngraph ...@@ -49,6 +49,7 @@ namespace ngraph
class Tensor; class Tensor;
} }
NGRAPH_API
std::string to_cplusplus_sourcecode_literal(bool val); std::string to_cplusplus_sourcecode_literal(bool val);
template <typename T> template <typename T>
...@@ -75,13 +76,18 @@ namespace ngraph ...@@ -75,13 +76,18 @@ namespace ngraph
return os.str(); return os.str();
} }
NGRAPH_API
size_t hash_combine(const std::vector<size_t>& list); size_t hash_combine(const std::vector<size_t>& list);
NGRAPH_API
void dump(std::ostream& out, const void*, size_t); void dump(std::ostream& out, const void*, size_t);
std::string to_lower(const std::string& s); std::string to_lower(const std::string& s);
NGRAPH_API
std::string to_upper(const std::string& s); std::string to_upper(const std::string& s);
NGRAPH_API
std::string trim(const std::string& s); std::string trim(const std::string& s);
NGRAPH_API
std::vector<std::string> split(const std::string& s, char delimiter, bool trim = false); std::vector<std::string> split(const std::string& s, char delimiter, bool trim = false);
template <typename T> template <typename T>
std::string locale_string(T x) std::string locale_string(T x)
{ {
...@@ -91,7 +97,7 @@ namespace ngraph ...@@ -91,7 +97,7 @@ namespace ngraph
return ss.str(); return ss.str();
} }
class stopwatch class NGRAPH_API stopwatch
{ {
public: public:
void start() void start()
...@@ -159,17 +165,17 @@ namespace ngraph ...@@ -159,17 +165,17 @@ namespace ngraph
/// template specializations for float and double to handle INFINITY, -INFINITY /// template specializations for float and double to handle INFINITY, -INFINITY
/// and NaN values. /// and NaN values.
template <> template <>
float parse_string<float>(const std::string& s); NGRAPH_API float parse_string<float>(const std::string& s);
template <> template <>
double parse_string<double>(const std::string& s); NGRAPH_API double parse_string<double>(const std::string& s);
/// template specializations for int8_t and uint8_t to handle the fact that default /// template specializations for int8_t and uint8_t to handle the fact that default
/// implementation ends up treating values as characters so that the number "0" turns into /// implementation ends up treating values as characters so that the number "0" turns into
/// the parsed value 48, which is it's ASCII value /// the parsed value 48, which is it's ASCII value
template <> template <>
int8_t parse_string<int8_t>(const std::string& s); NGRAPH_API int8_t parse_string<int8_t>(const std::string& s);
template <> template <>
uint8_t parse_string<uint8_t>(const std::string& s); NGRAPH_API uint8_t parse_string<uint8_t>(const std::string& s);
/// Parses a list of strings containing literals of the underlying type. /// Parses a list of strings containing literals of the underlying type.
template <typename T> template <typename T>
...@@ -199,18 +205,37 @@ namespace ngraph ...@@ -199,18 +205,37 @@ namespace ngraph
void check_fp_values_isnan(const char* name, const float* array, size_t n); void check_fp_values_isnan(const char* name, const float* array, size_t n);
void check_fp_values_isnan(const char* name, const double* array, size_t n); void check_fp_values_isnan(const char* name, const double* array, size_t n);
NGRAPH_API
void* ngraph_malloc(size_t size); void* ngraph_malloc(size_t size);
NGRAPH_API
void ngraph_free(void*); void ngraph_free(void*);
NGRAPH_API
size_t round_up(size_t size, size_t alignment); size_t round_up(size_t size, size_t alignment);
bool is_valid_permutation(ngraph::AxisVector permutation, ngraph::Rank rank = Rank::dynamic()); bool is_valid_permutation(ngraph::AxisVector permutation, ngraph::Rank rank = Rank::dynamic());
template <typename T> template <typename T>
T apply_permutation(T input, ngraph::AxisVector order); T apply_permutation(T input, ngraph::AxisVector order);
extern template NGRAPH_API AxisVector apply_permutation<AxisVector>(AxisVector input,
AxisVector order);
extern template NGRAPH_API Coordinate apply_permutation<Coordinate>(Coordinate input,
AxisVector order);
extern template NGRAPH_API Strides apply_permutation<Strides>(Strides input, AxisVector order);
extern template NGRAPH_API Shape apply_permutation<Shape>(Shape input, AxisVector order);
template <>
NGRAPH_API PartialShape apply_permutation(PartialShape input, AxisVector order);
NGRAPH_API
AxisVector get_default_order(size_t rank); AxisVector get_default_order(size_t rank);
NGRAPH_API NGRAPH_API
AxisVector get_default_order(const Shape& shape); AxisVector get_default_order(const Shape& shape);
NGRAPH_API
AxisVector get_permutation_to_default_order(const AxisVector& axis_order); AxisVector get_permutation_to_default_order(const AxisVector& axis_order);
// //
...@@ -235,6 +260,7 @@ namespace ngraph ...@@ -235,6 +260,7 @@ namespace ngraph
// The last argument is the adjoints coming into the bprop function, the output // The last argument is the adjoints coming into the bprop function, the output
// bprop function will have these nodes as the first N input parameters // bprop function will have these nodes as the first N input parameters
// //
NGRAPH_API
FpropCache cache_fprop(std::shared_ptr<Function> fprop, std::shared_ptr<Function> bprop); FpropCache cache_fprop(std::shared_ptr<Function> fprop, std::shared_ptr<Function> bprop);
// NodeExecutors are used in compiler optimization passes like ConstantFolding to execute a node // NodeExecutors are used in compiler optimization passes like ConstantFolding to execute a node
...@@ -365,6 +391,7 @@ namespace ngraph ...@@ -365,6 +391,7 @@ namespace ngraph
/// the patch version number. /// the patch version number.
/// ///
/// \note Throws a runtime_error if there is an error during parsing /// \note Throws a runtime_error if there is an error during parsing
NGRAPH_API
void parse_version_string( void parse_version_string(
std::string version, size_t& major, size_t& minor, size_t& patch, std::string& extra); std::string version, size_t& major, size_t& minor, size_t& patch, std::string& extra);
} // end namespace ngraph } // end namespace ngraph
...@@ -372,6 +399,7 @@ namespace ngraph ...@@ -372,6 +399,7 @@ namespace ngraph
template <typename T> template <typename T>
std::vector<T> read_vector(std::shared_ptr<ngraph::runtime::Tensor> tv); std::vector<T> read_vector(std::shared_ptr<ngraph::runtime::Tensor> tv);
std::vector<float> read_float_vector(std::shared_ptr<ngraph::runtime::Tensor> tv); std::vector<float> NGRAPH_API read_float_vector(std::shared_ptr<ngraph::runtime::Tensor> tv);
NGRAPH_API
std::ostream& operator<<(std::ostream& os, const ngraph::NodeVector& nv); std::ostream& operator<<(std::ostream& os, const ngraph::NodeVector& nv);
...@@ -33,6 +33,7 @@ namespace ngraph ...@@ -33,6 +33,7 @@ namespace ngraph
const PartialShape& data_batch_shape, const PartialShape& data_batch_shape,
const PartialShape& filters_shape); const PartialShape& filters_shape);
NGRAPH_API
PartialShape infer_windowed_reduction_output_shape(const Node* node, PartialShape infer_windowed_reduction_output_shape(const Node* node,
const PartialShape& data_shape, const PartialShape& data_shape,
const Strides& data_dilation, const Strides& data_dilation,
...@@ -44,6 +45,7 @@ namespace ngraph ...@@ -44,6 +45,7 @@ namespace ngraph
bool is_window_all_in_padding_allowed, bool is_window_all_in_padding_allowed,
bool ceil_mode = false); bool ceil_mode = false);
NGRAPH_API
PartialShape infer_convolution_forward(const Node* node, PartialShape infer_convolution_forward(const Node* node,
const PartialShape& data_batch_shape, const PartialShape& data_batch_shape,
const Strides& data_dilation, const Strides& data_dilation,
...@@ -53,6 +55,7 @@ namespace ngraph ...@@ -53,6 +55,7 @@ namespace ngraph
const Strides& filter_strides, const Strides& filter_strides,
const Strides& filter_dilation); const Strides& filter_dilation);
NGRAPH_API
PartialShape infer_batched_pooling_forward(const Node* node, PartialShape infer_batched_pooling_forward(const Node* node,
const PartialShape& data_batch_shape, const PartialShape& data_batch_shape,
const CoordinateDiff& data_padding_below, const CoordinateDiff& data_padding_below,
...@@ -62,6 +65,7 @@ namespace ngraph ...@@ -62,6 +65,7 @@ namespace ngraph
bool is_window_all_in_padding_allowed, bool is_window_all_in_padding_allowed,
bool ceil_mode = false); bool ceil_mode = false);
NGRAPH_API
std::tuple<element::Type, PartialShape, PartialShape> std::tuple<element::Type, PartialShape, PartialShape>
infer_batch_norm_forward(const Node* node, infer_batch_norm_forward(const Node* node,
element::Type input_element_type, element::Type input_element_type,
...@@ -75,6 +79,7 @@ namespace ngraph ...@@ -75,6 +79,7 @@ namespace ngraph
const PartialShape& mean_shape, const PartialShape& mean_shape,
const PartialShape& variance_shape); const PartialShape& variance_shape);
NGRAPH_API
std::tuple<element::Type, PartialShape, PartialShape> std::tuple<element::Type, PartialShape, PartialShape>
infer_batch_norm_forward(const Node* node, infer_batch_norm_forward(const Node* node,
element::Type input_element_type, element::Type input_element_type,
...@@ -84,6 +89,7 @@ namespace ngraph ...@@ -84,6 +89,7 @@ namespace ngraph
const PartialShape& gamma_shape, const PartialShape& gamma_shape,
const PartialShape& beta_shape); const PartialShape& beta_shape);
NGRAPH_API
void infer_auto_padding(const Shape& image_shape, void infer_auto_padding(const Shape& image_shape,
const Shape& filter_shape, const Shape& filter_shape,
const Strides& filter_strides, const Strides& filter_strides,
...@@ -92,6 +98,7 @@ namespace ngraph ...@@ -92,6 +98,7 @@ namespace ngraph
CoordinateDiff& padding_above, CoordinateDiff& padding_above,
CoordinateDiff& padding_below); CoordinateDiff& padding_below);
NGRAPH_API
PartialShape infer_slice_shape(const Node* node, PartialShape infer_slice_shape(const Node* node,
const PartialShape& input_shape, const PartialShape& input_shape,
const std::vector<int64_t>& begin, const std::vector<int64_t>& begin,
...@@ -188,6 +195,7 @@ namespace ngraph ...@@ -188,6 +195,7 @@ namespace ngraph
/// \param[in] output_padding The output padding values. /// \param[in] output_padding The output padding values.
/// \param output_spatial_shape The placeholder for computed output spatial shape. /// \param output_spatial_shape The placeholder for computed output spatial shape.
/// ///
NGRAPH_API
void infer_conv_backprop_output_spatial_shape(const Shape& input_data_shape, void infer_conv_backprop_output_spatial_shape(const Shape& input_data_shape,
const Shape& filters_shape, const Shape& filters_shape,
const Strides& strides, const Strides& strides,
...@@ -210,6 +218,7 @@ namespace ngraph ...@@ -210,6 +218,7 @@ namespace ngraph
/// \param pads_begin The placeholder for paddings at the beginning of axis. /// \param pads_begin The placeholder for paddings at the beginning of axis.
/// \param pads_end The placeholder for paddings at the end of axis. /// \param pads_end The placeholder for paddings at the end of axis.
/// ///
NGRAPH_API
void infer_conv_backprop_auto_padding(const Shape& input_data_shape, void infer_conv_backprop_auto_padding(const Shape& input_data_shape,
const Shape& filters_shape, const Shape& filters_shape,
const Shape& output_shape, const Shape& output_shape,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment