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