From 8235c2cf96fd4ac427be2968c5214623015f89bc Mon Sep 17 00:00:00 2001 From: Scott Cyphers Date: Tue, 3 Dec 2019 14:36:35 -0800 Subject: [PATCH] Cyphers/27catchup (#3978) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix broadcast v1 reference (#3880) * Added reproducer for issue with broadcast v1 * Make reference broadcast work with V1 broadcast * Deprecate runtime::Tensor::copy_from * Force Gelu decompose on CPU (#3887) * Round the right bit with denorms (#3885) * Round the right bit with denorms * Rounding to inf * Attribute visitor (#3579) * Sketch of attribute walker * Review comments * merge error? * Remove unused method * simplify, make some ser tests work * Don't look for keys that aren't there * Factory registry, more ops visited, generic ser/dser start * More merge * cleanup * Adapter for enums * Compiler error * Test of user-defined op * Simplify enum name pairing * Update distributed.hpp * Review comments * compiler error * Direct access to non-primitive types from adapters * Define and export type info * attr enums, AvgPool*, vectors * Cleanup * some comments * Allow type info to be used as a key. * Don't leave output serialization shapes set. * Auto adapter * More ops, adapters * Missing symbol * Remove PartialShape and element::Type methods from visitor * Fix type info * Remove unused variable * Simplify * namespace error * exports * Uniform names * Some better names * More name cleanup, simplify visitor implementation * Fix template, add test * Revert serializer * Add instantiations * Work-around gcc issue * VS exports * VS exports * windows export * vs * vs * vs * vs * Simplify * vs * vs * Add some missing attributes * Missing factories * Merge error * Fix Add factories * Missed type * [FUSED] Add new LogSoftmax fused op (#3867) * LogSoftmax introduced * Added LogSoftmax to serializer * Fixed style * Fixed CmakeLists style * code review remarks introduced * Code review remarks introduced * [ONNX] Importer should use fused op for MatMul (#3842) * [ONNX] Importer should use fused op for MatMul * Fix a bug in fused matmul op * Dont reshape matmul inputs to at least 2D any more * [SPEC] Add auto_broadcast parameter to SquaredDifference (#3856) * [SPEC] Add auto_broadcast parameter to SquaredDifference * Rename set_autobroadcast->set_autob * [Spec][FusedOp]Adjust SpaceToDepth fused op to specification (#3862) * Added support mode for SpaceToDepth * Added unit tests * Fixed styles * Revert changes in prototxt files * Force AutoBroadcast defaults (#3878) * Force AutoBroadcast to be specified at the op level since no default is correct for all ops. * exports * Added constant folding for binary ops (#3895) * Modify Gather constant folding to support v1 op. * Address PR feedback. * Update fused ops groupconvolution, gelu and layernorm to be dynamic friendly (#3876) * set output et * set output et * overwrote validate and infer * Add full path to gtest for build via ninja (#3882) * [FUSED] Add reciprocal op (#3851) * [FUSED] Add reciprocal op * Review Fix #1 * Move operator op::v1 -> op * Fix serializer * Review Fix I * [SPEC] Add new v1::FloorMod operator (#3852) * [SPEC] Add new v1::FloorMod operator * Review Fix I * [MLIR] Fix MLIR build on mac OS (#3896) * Fix MLIR build on mac OS * Style * Style * [MLIR] Bump MLIR commit to c61db4bb (#3879) * WIP * WIP * WIP * WIP * style * WIP * WIP * Add err msg * Fix headers and cleanup * Bug Fix: incorrect shape validation logic. (#3897) * Allow for overriding functions in visualization (#3900) * Add ReplaceSlice to ZeroDimTensorEliminiation pass (#3899) (#3910) * Add ReplaceSlice to ZeroDimTensorEliminiation pass * style * Default constructor needs to init autob (#3913) * Implementation of CrossEntropy and CrossEntropyBackprop as fused Op's (#3818) * - Implementaion of CrossEntropy and CrossEntropyBackprop as fused Op's * - unit test case for CE fprop - fix bug in decompose_op * WIP debug PDPD unit test failure * fixed broadcasting issue * -fix bdcast issue for multi dim tensor * utilities to restore the original tensor shape * i) style-fix ii) rename variables * - unit test for multiple dimensions ii) refactor create_mask to seperate function * - fixed unit tests * fix style * set output element type to dynamic in pre_validate and infer shape * disable ce with one hot unit test on PlaidML * add CE op to fused_op_tbl * - add serialzier support for CE and CE Backprop * Update ToC to better match docplan spreadsheet (#3846) * New ToC * Working on docplan * Clean up for toc * Link to existing APIs on quantization doc * Better align topics with docplan ToC; add section for dyn shapes * Title casing to be consistent * PR reviews * New build preview * Add default opset version, new versioning schema * Remove duplicate file causing doc build warning * Fix CSS rendering issues (#3921) * Fix for the bug with as_type_ptr for TensorIterator::Input/Ouput desc (#3906) * Updated unit test to reproduce a bug * Code style * Add exports * Added missed export * Bug fix in conv v1 shape inference (#3912) * [SPEC] Add new v1::VariadicSplit operator (#3868) * [SPEC] Add new v1::VariadicSplit operator * Add missing namespace, fix a typo in doc * Apply suggestions from code review Co-Authored-By: Michał Karzyński * Style fix * Set all of the inputs to be relevant to output shape * Set output type if numer of outputs is known * Add node validation for known input * Fix for windows ninja (#3917) * Fix for windows ninja * Fix for centos build * Remove fix for centosa * Update ONNX importer to use v1 version of Softmax (#3894) * Added downgrade pass for Softmax. * Updated Softmax op to v1. * Created vector with a right capacity. * Include numeric header to enable std::iota function * Removed unused numeric header from the old file * Fix includes style * Fix shape inference of TensorIterator body (#3922) * fix for shape inference of tensor iterator body * updated unit test for case end = -2 * indexes in unit tests * Updated formula for num_iterations * resolve compiler warning (#3923) * Added u1 precision for binary weights (#3914) * Added U1 precision for binary weights * Handle switch cases with u1 type * Fixed code style * Added convert_to_string support for u1 type * Use real C type for u1 type. Co-Authored-By: Robert Kimball * Fused_op: BatchMatMulTranspose (#3871) * Initial commit * Add decompose_op and unit-test * Style fix * Fix CI error * Address review comments * Remove CPUBatchFusion * Address review feedback * Address review feedback * Added type_prop tests * Moved 1 test from cpu to core to keep together * Address PR comments * Fix style * Change repositories addresses to use SSH (#3889) * Move CPU only unit tests to the cpu test file (#3919) * Cyphers/uop (#3903) * Address op_tbl issues * fix * fix * fix * Cleanup * cleanup * cleanup * More fixes * Revert ser changes * Compiles * opset conversion fixed * Fix opset conversion tests * Deal with Reciprocal and FloorMod movement * Cleanup * Remove duplicate enums * Experiment * experiment * Types * Reorg around clang 3.9 bug * Add default constructor to some ops missing them (#3924) * [SPEC] HardSigmoid adjustments (#3857) * Construct HardSigmoid with alpha and beta as inputs * Switch to the new HardSigmoid constructor entirely * Broadcast with numpy style in hard sigmoid * Python bindings adjustment to the new constructor * Different way of creating constants * Accept scalars instead of 1D vectors for alpha and beta * Adjust the python tests to the new HardSigmoid constructor * Use v1 ops in fused HardSigmoid * Relax the static shape requirement for alpha and beta * Fix merge * CropAndResize op (#3893) (#3925) * Stub for CropAndResize * Cut and pasteo * Need a cast * Put all the op header includes in one header file, ops.hpp (#3929) * Put all the op header includes in one header file, ops.hpp * Update ops.hpp * Fix compilation issues for default constructors (#3928) * Make Node's type_info mandatory (#3891) * Make Node's type_info mandatory * Add ReplaceSlice to ZeroDimTensorEliminiation pass (#3899) * Add ReplaceSlice to ZeroDimTensorEliminiation pass * style * Force Gelu decompose on CPU (#3902) * Copy rt info (#3934) * Matmul float type test case for UEP (#3877) * Matmul float type test case for UEP Signed-off-by: suryasidd * Removed microsoft ops domains and ran clang-format Signed-off-by: suryasidd * [SPEC] Add OneHot:v1 (#3884) * Moved OneHot to v0 * Introduced OneHot:v1 * Added shape calculation for OneHot:v1 * Added element types checking * Added output shape tests * Added tests to checking if inputs are scalars * Updated OneHot:v1 doc * Implemented OneHot:v1 downgrade pass * Using OneHot:v1 in onnx_importer * Implemented OneHot:v0 upgrade * Fixed OneHot onnx_importer * Refactored normalize_axis * Added OneHot:v1 serialized * Code review remarks introduced * Added doc to normalize_axis * Enable pipelining in CPU Backend (#3916) * Enable pipelining in CPU Backend * Applying clang-formatting to my previous commit * Changing CPU backend test. executable_can_create_tensor will now return true * [SPEC] Add support string as AutoBroadcastSpec (#3909) * Support string casting to AutoBroadcastSpec * Make string values consistent * Adding default ctor for Constant (#3938) * Adding default ctor * Address PR feedback * Cumulative Sum (#3873) * - Op defination for cummalative sum * WIP reference kernel for cummulative sum * - unit test case for default cum_sum - addition ctor for cumsum to accept axis as a integer insted of Node type - style fix * - add serializer support - fix failing unit test case - update Op in the interpreter dispatcher * - CPU builder and DEX support for CumSum * - implemented mapping tensor elements to corrosponding axis * - unit test for multiple dims - fix axis in the op defination - support for reference kernel to compute across all axis * - added support for exclusive and reverse modes - more unit test case for all modes * - codegen support for CumSum - disable CumSum unit test for PlaidML * -Add missing header to codegen stream writer * fixed codegen writer * change return type of exclusive and reverse to bool * - support for dynamic shape - support to handle all tensor types in CPU builder * - add support for interpreter to handle different axis types * Style fix * Fix incorrect uses of `description()` (#3946) * Fix incorrect uses of `description()` * type-o/namespace * Move non-primitive attribute adapters to adaptee's files (#3949) * Move non-primitive attribute adapters to adaptee's files * Cast in copy * Update ONNX importer Gemm to produce MatMul op (#3927) * Update ONNX importer Gemm to produce MatMul op * Address opset3 bug * [SPEC][FusedOp] Add Mod operator (#3908) * Mod operator introduced * Introduced onnx importer, fixed implementation * styles applied * Refactored assert comment for mod * Add failure mod test to plaidml manifest * Code review remarks introduced * Changed ops used in decompose to v1 * Moved Mod to op_v1_tbl * Partially fixed visibility for symbols (Ops, Nodes, Transformations, Matchers) (#3767) * Partially fixed visibility for symbols: * Resolved issues with RTTI and AppleClang * style * review fixes * fixed compilation with msvc 2019 * Export extra API which is used in other public classes * CMAKE: MSVS -> MSVC * Fixed template export * Fixed compilation flags * Fixed default args * removed self-inclusion * export * shape * export strides * Export all symbols needed for OpenVINO * Export * disable cpu * AxisSet * disable warning * fix * removed second declaration * fixed runtime exports * Reverted some changes * Fixed LNK2005 error on Windows * Fixed code style check * Fixed EnumAttributeAdapterBase * Remove export of template classes * Fixed code style for EnumAttributeAdapterBase * Fixed for protobuf * Test cleanups (#3942) * Documentation for Dynamic Shapes and additional graph construction options (#3930) * Initial dynamic shapes doc * Basics on dynamic shapes, with example code * Add glossary defs and dynamic shapes example * Slightly better organization * Address make style check failure, maybe * Test dynamic shapes doc w 0.27.0-rc.0+9aa81d9 * Resolve doc build error w new opset versioning * Review comments addressed * Add theme-relevant revised illustrations from collab_ngai * style * Style fixes * Run make style-apply with clang-format-3.9 * [ONNX] Add CumSum to ONNX importer (#3918) * Register CumSum operator in onnx importer * Missing whitespace * Update CMakeLists.txt * ONNX importer - CumSum op init * Simple CumSum onnx model * ONNX CumSum model simple test * Default axis * Axis input test * Inputs variable * Style apply * Test 3d exclusive reverse * Apply style * Add memory header and std namespace * Add model_cum_sum tests to plsidml unit_test.manifest * Add model_cum_sum tests to plaidml unit_test.manifest * Changed default axis type * Test model update * Style apply * Add test for dynamic axis input * [MLIR] Fused Ops dialect declaration (#3860) * WIP * WIP * WIP * All ops * Fix layernorm backprop op name * WIP: Adding tests * WIP: Adding LIT parsing/printing tests * WIP * Added LSTM cells. Fixed some ops * All builder tests * PR fixes * Fix spacing. Add missing setter to SpaceToDepth * Update spaceToDepth lit test * PR fixes * Build fix * Another fix * Fixed optional args * [MLIR] Enable ViewOp in Affine Lowerer (#3911) * Map each ng tensor to a linear buffer and a view * fix comment * Create views only when a value is assigned a buffer id * style * Fix lit test * ConstantFolding for v1::StridedSlice operation (#3955) * constant folding for strided slice * code style * Refactoring * fix for warning: deleting an unused variable * Opset1 Definition (#3813) * Opset1 * Added opset1.hpp * Added more ops to opset0 and opset1 * Move opset1.hpp up and remove opset0.hpp * Add versioning to more ops * Revert to older pass names to keep compatibility for external components * Fix compilation errors with codegen * merge * Added compile-time check for opset * Added opset1 tbl * Add op_version table of all ops * Create factories from op_version_tbl * reorg unsupported ops in int backend * Added temporary alias for GreaterEqual * Add missing case to interpreter enumeration * Finish opset serializer cleanup (#3939) * Opset-based opset conversion (#3937) * Opset-based opset conversion * Add other opset conversion * Use ops.hpp * Update opset0_tbl.hpp * Switch interpreter to opset0 + a few extras (#3941) * Switch interpreter, gcpu to opset0 * Remove unnused files * Give interpreter its own opset * style * Fix namespace * Fix rounding type conversion * Work-around for bad clang3.9 bug * Work-around * [SPEC] Add negative axes support for ReverseSequence (#3926) * Added negative axes support for ReverseRequence * code review remarks introduced * Disable reverse sequence for PlaidMl tests * Fixed styles * Fixed axes assignment * Fixed normalized axes assignment * [SPEC] Adjust ConvolutionBackpropData op. (#3935) * [SPEC] Adjust ConvolutionBackpropData op. ``` inputs: 1. filters-------+ 2. output_delta | -> 1. data +---> 2. filters 3. data_batch_shape -> 3. output_shape(+optional) attributes: 1. strides -> 1. strides 2. dilations-----+ 3. pads_begin | -> 2. pads_begin 4. pads_end | -> 3. pads_end +---> 4. dilations -> 5. +auto_pad(optional)[PadType::EXPLICIT] -> 6. +output_padding(optional)[zeros] ``` * Review fix I * [SPEC] ConvertLike op (#3944) * [Spec] Add 3-input constructor to DetectionOutput (#3966) * Add 3-input constructor to DetectionOutput * Review comments * v1::Reshape zero_flag renamed. Default value unset (#3945) * Add groupconvolution bprop (#3940) * add placeholder for conv bprop * add constructor, api, serializer and can compile * implement decompose_op * fix arg num * fix and update * address comment, clean up and add ut placeholder * update ut * address comment on groups * Added explicit dependencies between buildable target and external project (#3962) * Relax check on LRN for rank requirement to be >=3 (#3952) * relax check for LRN for requirement rank should be >=3 * rename unit test names * - Disable lrn unit test with axes for CPU backend * remove outdated unit test on rank requirement from type_prop * - disable newly added lrn unit test in plaidMl * [SPEC] ReduceLogicalAnd & ReduceLogicalOr (#3874) * ReduceLogicalAnd op implementation * ReduceLogicalOr op implementation * Add basic constant folding support * Fix typo * Revert "Add basic constant folding support" This reverts commit 5d14a1849e957858dd5f6615981b154a381a1127. * Introduce and use a new base class for logical reductions * Constant folding for v1::ReduceLogicalAnd * Constant folding for v1::ReduceLogicalOr * Obsolete cout removal * [SPEC] Adjust Split (#3943) * Changed axis to Node * Added using normalize from validation util * refactored split * Added typrop tests to Split * Added set_input_is_relevant_to_shape for Split * clang style applied * Fixed var name * Code refactor * mergre from master. part.2 * Constructor to provide CI compatibility * CI compatibility * CI compatibility * Updated get_outputs * CI compitability * Fixed get_outputs function * [SPEC] Add DeformablePSROIPooling v1 (#3954) * Initial commit * Moved DeformablePSROIPooling to v1 * Moved DeformablePSROIPooling to v1. Part.2 * Added missing fields * Added inferance shape * Added type prop UT * Added serialization * Doc + styles applied * Revert incorrect changes * Revert incorrect changes. Part.2 * Moved to NGRAPH_API * integration with master * Code review remarks introduced * DeformablePSROIPooling updated to new spec * Add v1 version of Subtract with Numpy broadcasting as default (#3957) * V1 version of Subtract with default Numpy autobcast * Update op_v1_tbl.hpp with v1 version of Subtract * Use v1 of Subtract in ONNX importer * Add v1 namespace * Update namspece * Missing punctuation * Add Subtract to opset0 downgrade * Add Subtract to opset1 upgrade * Add Subtract header to cpu emmiter * Update serializer * Add Subtract to opset_pass tests * Use downgrade method * Add get_version method * Style apply * Add v1 Substract to check opset1 * Add NGRAPH_API before class name * Removed get_version method * Separate cases for Subtract and Subtract_v1 in serializer * Update op_version_tbl with v1 Subtract * NUMPY autobcast for no args constructor * Add Subtract_v1 to serializer * [SPEC] Add constant folding for LogicalNot:v1 (#3961) * Added consant folding for LogicalNot * Fixed alphabetical order * Update the tolerance on auto_broadcast_test (#3959) * Copy RT info for parameters (#3969) * [SPEC] Add GatherTree:v1 (#3967) * GatherTree introduced * Added GatherTree type_prop tests --- .ci/onnx/jenkins/Jenkinsfile | 8 +- CMakeLists.txt | 47 +- cmake/Modules/fix_mode.cmake | 3 +- cmake/external_gtest.cmake | 18 + cmake/external_mlir.cmake | 4 +- cmake/external_protobuf.cmake | 39 +- doc/examples/dynamic_tensor/partial_shape.cpp | 68 + doc/sphinx/ngraph_theme/layout.html | 17 +- doc/sphinx/ngraph_theme/ngversions.html | 9 +- doc/sphinx/ngraph_theme/static/css/theme.css | 22 +- doc/sphinx/source/backends/index.rst | 2 +- doc/sphinx/source/buildlb.rst | 2 +- .../constructing-graphs/distribute-train.rst | 4 +- .../core/constructing-graphs/execute.rst | 158 +- .../source/core/constructing-graphs/index.rst | 31 +- doc/sphinx/source/core/overview.rst | 2 +- doc/sphinx/source/core/passes/passes.rst | 2 +- doc/sphinx/source/core/quantization.rst | 169 ++ doc/sphinx/source/dynamic/index.rst | 41 + doc/sphinx/source/frameworks/index.rst | 4 +- doc/sphinx/source/frameworks/onnx_integ.rst | 4 +- .../frameworks/{other.rst => other/index.rst} | 21 +- doc/sphinx/source/frameworks/overview.rst | 7 +- doc/sphinx/source/frameworks/paddle_integ.rst | 10 +- doc/sphinx/source/frameworks/quickstart.rst | 2 +- .../source/frameworks/tensorflow_connect.rst | 4 +- doc/sphinx/source/glossary.rst | 14 + .../graphics/ExecutionInterfaceRunGraphs.png | Bin 43756 -> 0 bytes .../source/graphics/dl-current-state.png | Bin 115878 -> 0 bytes .../source/graphics/dl-current-state.xcf | Bin 383128 -> 0 bytes .../execution-interface-run-graph.svg | 1 + .../source/graphics/paddlepaddle_design.png | Bin 75029 -> 0 bytes .../source/graphics/paddlepaddle_design.svg | 1 + .../source/graphics/scalability-matters.png | Bin 127923 -> 0 bytes .../source/graphics/scalability-matters.xcf | Bin 397890 -> 0 bytes .../graphics/simple-compiler-passes.png | Bin 90633 -> 0 bytes .../graphics/simple-compiler-passes.svg | 1 + doc/sphinx/source/index.rst | 44 +- doc/sphinx/source/ops/add.rst | 2 +- doc/sphinx/source/ops/and.rst | 2 +- doc/sphinx/source/ops/broadcast.rst | 2 +- doc/sphinx/source/ops/divide.rst | 2 +- doc/sphinx/source/ops/equal.rst | 2 +- doc/sphinx/source/ops/greater.rst | 2 +- doc/sphinx/source/ops/greater_eq.rst | 2 +- doc/sphinx/source/ops/index.rst | 13 +- doc/sphinx/source/ops/less.rst | 2 +- doc/sphinx/source/ops/less_eq.rst | 2 +- doc/sphinx/source/ops/maximum.rst | 2 +- doc/sphinx/source/ops/minimum.rst | 2 +- doc/sphinx/source/ops/multiply.rst | 2 +- doc/sphinx/source/ops/not.rst | 2 +- doc/sphinx/source/ops/not_equal.rst | 2 +- doc/sphinx/source/ops/one_hot.rst | 2 +- doc/sphinx/source/ops/or.rst | 2 +- doc/sphinx/source/ops/power.rst | 2 +- doc/sphinx/source/ops/slice.rst | 2 +- doc/sphinx/source/ops/xor.rst | 2 +- doc/sphinx/source/project/release-notes.rst | 39 +- doc/sphinx/source/provenance/index.rst | 8 +- doc/sphinx/source/training/data_ingest.rst | 31 + doc/sphinx/source/training/index.rst | 13 + doc/sphinx/source/training/overview.rst | 31 + doc/sphinx/source/training/paddle_dist.rst | 7 + doc/sphinx/source/training/qat.rst | 32 + doc/sphinx/source/training/tf_dist.rst | 7 + python/ngraph/ops.py | 9 +- python/pyngraph/ops/fused/hard_sigmoid.cpp | 4 +- python/pyngraph/ops/fused/space_to_depth.cpp | 2 +- python/test/ngraph/test_ops_fused.py | 15 +- src/contrib/mlir/CMakeLists.txt | 7 +- .../mlir/backend/pass/affine_lowerer.cpp | 146 +- src/contrib/mlir/core/compiler.cpp | 1 - src/contrib/mlir/core/compiler.hpp | 1 - .../mlir/core/ngraph_dialect/dialect.cpp | 103 +- .../mlir/core/ngraph_dialect/dialect.hpp | 7 +- .../mlir/core/ngraph_dialect/fused_ops.td | 983 ++++++- src/contrib/mlir/core/ngraph_dialect/ops.cpp | 97 + src/contrib/mlir/core/ngraph_dialect/ops.td | 4 +- .../core/ngraph_dialect/ops_attributes.td | 50 +- .../mlir/core/ngraph_dialect/ops_v0.td | 12 +- .../mlir/core/pass/ng_dialect_builder.cpp | 27 +- .../mlir/core/pass/ng_dialect_builder.hpp | 10 +- src/contrib/mlir/runtime/cpu/cpu_runtime.cpp | 26 +- src/contrib/mlir/runtime/cpu/cpu_runtime.hpp | 7 +- src/contrib/mlir/runtime/runtime.hpp | 1 - src/ngraph/CMakeLists.txt | 41 +- src/ngraph/attribute_adapter.cpp | 225 ++ src/ngraph/attribute_adapter.hpp | 294 ++ src/ngraph/attribute_visitor.hpp | 72 + src/ngraph/axis_set.cpp | 66 + src/ngraph/axis_set.hpp | 55 +- src/ngraph/axis_vector.cpp | 40 + src/ngraph/axis_vector.hpp | 40 +- src/ngraph/builder/make_constant.hpp | 2 + src/ngraph/coordinate.cpp | 66 + src/ngraph/coordinate.hpp | 54 +- src/ngraph/coordinate_diff.cpp | 61 + src/ngraph/coordinate_diff.hpp | 53 +- src/ngraph/coordinate_transform.hpp | 4 +- src/ngraph/descriptor/input.hpp | 9 +- .../descriptor/layout/dense_tensor_layout.hpp | 2 +- .../descriptor/layout/tensor_layout.hpp | 2 +- src/ngraph/descriptor/output.hpp | 11 +- src/ngraph/descriptor/tensor.hpp | 3 +- src/ngraph/dimension.hpp | 4 +- src/ngraph/distributed.cpp | 34 +- src/ngraph/distributed.hpp | 16 + src/ngraph/distributed/open_mpi.hpp | 1 + src/ngraph/enum_names.hpp | 88 + src/ngraph/factory.cpp | 53 + src/ngraph/factory.hpp | 60 + .../frontend/onnx_import/CMakeLists.txt | 13 +- src/ngraph/frontend/onnx_import/onnx.hpp | 5 + .../op/{matmul.cpp => cum_sum.cpp} | 35 +- .../frontend/onnx_import/op/cum_sum.hpp | 38 + src/ngraph/frontend/onnx_import/op/gemm.cpp | 86 +- src/ngraph/frontend/onnx_import/op/gemm.hpp | 6 + .../frontend/onnx_import/op/hard_sigmoid.cpp | 14 +- .../frontend/onnx_import/op/log_softmax.cpp | 48 + .../frontend/onnx_import/op/log_softmax.hpp | 7 +- src/ngraph/frontend/onnx_import/op/matmul.hpp | 7 +- src/ngraph/frontend/onnx_import/op/mod.cpp | 50 + src/ngraph/frontend/onnx_import/op/mod.hpp | 39 + src/ngraph/frontend/onnx_import/op/onehot.cpp | 57 +- .../frontend/onnx_import/op/reciprocal.cpp | 9 +- src/ngraph/frontend/onnx_import/op/selu.cpp | 2 +- .../frontend/onnx_import/op/softmax.cpp | 8 +- .../frontend/onnx_import/op/softmax.hpp | 3 +- .../onnx_import/op/space_to_depth.cpp | 4 +- src/ngraph/frontend/onnx_import/op/split.cpp | 28 +- src/ngraph/frontend/onnx_import/op/sub.hpp | 6 +- .../frontend/onnx_import/ops_bridge.cpp | 5 + .../frontend/onnx_import/utils/common.cpp | 39 +- .../frontend/onnx_import/utils/common.hpp | 7 + src/ngraph/function.hpp | 2 +- src/ngraph/graph_util.hpp | 2 + src/ngraph/lambda.hpp | 3 +- src/ngraph/ngraph.hpp | 137 +- src/ngraph/ngraph_visibility.hpp | 9 +- src/ngraph/node.cpp | 42 +- src/ngraph/node.hpp | 20 +- src/ngraph/op/abs.hpp | 47 +- src/ngraph/op/acos.hpp | 47 +- src/ngraph/op/add.cpp | 12 + src/ngraph/op/add.hpp | 22 +- src/ngraph/op/all.hpp | 49 +- src/ngraph/op/allreduce.cpp | 8 + src/ngraph/op/allreduce.hpp | 33 +- src/ngraph/op/and.cpp | 12 + src/ngraph/op/and.hpp | 10 +- src/ngraph/op/any.hpp | 5 +- src/ngraph/op/argmax.cpp | 6 + src/ngraph/op/argmax.hpp | 45 +- src/ngraph/op/argmin.cpp | 6 + src/ngraph/op/argmin.hpp | 45 +- src/ngraph/op/asin.hpp | 49 +- src/ngraph/op/atan.hpp | 49 +- src/ngraph/op/atan2.hpp | 8 +- src/ngraph/op/avg_pool.cpp | 47 + src/ngraph/op/avg_pool.hpp | 17 +- src/ngraph/op/batch_norm.cpp | 18 + src/ngraph/op/batch_norm.hpp | 355 +-- src/ngraph/op/binary_convolution.cpp | 13 +- src/ngraph/op/binary_convolution.hpp | 3 +- src/ngraph/op/broadcast.cpp | 21 + src/ngraph/op/broadcast.hpp | 15 +- src/ngraph/op/broadcast_distributed.cpp | 12 +- src/ngraph/op/broadcast_distributed.hpp | 35 +- src/ngraph/op/ceiling.hpp | 34 +- src/ngraph/op/concat.cpp | 6 + src/ngraph/op/concat.hpp | 80 +- src/ngraph/op/constant.cpp | 5 + src/ngraph/op/constant.hpp | 11 +- src/ngraph/op/convert.hpp | 66 +- src/ngraph/op/convert_like.cpp | 48 + src/ngraph/op/convert_like.hpp | 52 + src/ngraph/op/convolution.cpp | 296 +- src/ngraph/op/convolution.hpp | 93 +- src/ngraph/op/cos.hpp | 39 +- src/ngraph/op/cosh.hpp | 39 +- src/ngraph/op/crop_and_resize.cpp | 198 ++ src/ngraph/op/crop_and_resize.hpp | 75 + src/ngraph/op/cum_sum.cpp | 60 + src/ngraph/op/cum_sum.hpp | 109 + src/ngraph/op/deformable_psroi_pooling.cpp | 115 + src/ngraph/op/deformable_psroi_pooling.hpp | 93 + src/ngraph/op/dequantize.hpp | 3 +- src/ngraph/op/divide.hpp | 17 +- src/ngraph/op/dot.hpp | 120 +- src/ngraph/op/embedding_lookup.hpp | 62 +- src/ngraph/op/equal.hpp | 6 +- src/ngraph/op/erf.hpp | 23 +- src/ngraph/op/exp.hpp | 37 +- src/ngraph/op/experimental/batch_mat_mul.hpp | 3 +- .../op/experimental/compiled_kernel.hpp | 3 +- src/ngraph/op/experimental/dyn_broadcast.hpp | 3 +- src/ngraph/op/experimental/dyn_pad.hpp | 3 +- .../op/experimental/dyn_replace_slice.hpp | 3 +- src/ngraph/op/experimental/dyn_reshape.hpp | 3 +- src/ngraph/op/experimental/dyn_slice.hpp | 3 +- src/ngraph/op/experimental/generate_mask.hpp | 6 +- .../layers/ctc_greedy_decoder.hpp | 44 +- .../experimental/layers/detection_output.cpp | 32 +- .../experimental/layers/detection_output.hpp | 71 +- .../op/experimental/layers/interpolate.hpp | 46 +- .../op/experimental/layers/prior_box.hpp | 48 +- .../layers/prior_box_clustered.hpp | 50 +- .../op/experimental/layers/proposal.hpp | 48 +- .../op/experimental/layers/psroi_pooling.hpp | 86 +- .../op/experimental/layers/region_yolo.hpp | 103 +- .../op/experimental/layers/reorg_yolo.hpp | 38 +- .../op/experimental/layers/roi_pooling.hpp | 60 +- .../op/experimental/quantized_conv_bias.hpp | 11 +- .../op/experimental/quantized_conv_relu.hpp | 3 +- .../op/experimental/quantized_dot_bias.hpp | 3 +- src/ngraph/op/experimental/random_uniform.hpp | 3 +- src/ngraph/op/experimental/range.cpp | 1 + src/ngraph/op/experimental/range.hpp | 47 +- src/ngraph/op/experimental/shape_of.hpp | 29 +- src/ngraph/op/experimental/tile.hpp | 43 +- src/ngraph/op/experimental/transpose.hpp | 47 +- src/ngraph/op/floor.hpp | 33 +- src/ngraph/op/floor_mod.cpp | 36 + src/ngraph/op/floor_mod.hpp | 60 + .../fused}/batch_mat_mul_transpose.cpp | 60 +- .../fused}/batch_mat_mul_transpose.hpp | 9 +- src/ngraph/op/fused/clamp.hpp | 54 +- src/ngraph/op/fused/conv_fused.hpp | 397 +-- src/ngraph/op/fused/crossentropy.cpp | 292 ++ src/ngraph/op/fused/crossentropy.hpp | 93 + src/ngraph/op/fused/depth_to_space.hpp | 86 +- src/ngraph/op/fused/elu.hpp | 45 +- src/ngraph/op/fused/fake_quantize.hpp | 105 +- src/ngraph/op/fused/gelu.cpp | 12 + src/ngraph/op/fused/gelu.hpp | 71 +- src/ngraph/op/fused/gemm.hpp | 91 +- src/ngraph/op/fused/grn.hpp | 45 +- src/ngraph/op/fused/group_conv.cpp | 236 +- src/ngraph/op/fused/group_conv.hpp | 214 +- src/ngraph/op/fused/group_conv_transpose.hpp | 233 +- src/ngraph/op/fused/gru_cell.hpp | 263 +- src/ngraph/op/fused/hard_sigmoid.cpp | 76 +- src/ngraph/op/fused/hard_sigmoid.hpp | 49 +- src/ngraph/op/fused/layer_norm.cpp | 4 +- src/ngraph/op/fused/layer_norm.hpp | 221 +- src/ngraph/op/fused/log_softmax.cpp | 54 + src/ngraph/op/fused/log_softmax.hpp | 54 + src/ngraph/op/fused/lstm_cell.hpp | 433 +-- src/ngraph/op/fused/lstm_sequence.hpp | 264 +- src/ngraph/op/fused/matmul.cpp | 23 +- src/ngraph/op/fused/matmul.hpp | 57 +- src/ngraph/op/fused/mod.cpp | 61 + src/ngraph/op/fused/mod.hpp | 62 + src/ngraph/op/fused/mvn.hpp | 98 +- src/ngraph/op/fused/normalize_l2.hpp | 68 +- src/ngraph/op/fused/partial_slice.hpp | 139 +- src/ngraph/op/fused/prelu.hpp | 39 +- src/ngraph/op/fused/reciprocal.cpp | 43 + src/ngraph/op/fused/reciprocal.hpp | 46 + src/ngraph/op/fused/rnn_cell.hpp | 181 +- src/ngraph/op/fused/scale_shift.hpp | 45 +- src/ngraph/op/fused/selu.cpp | 10 +- src/ngraph/op/fused/selu.hpp | 10 +- src/ngraph/op/fused/shuffle_channels.hpp | 73 +- src/ngraph/op/fused/softmax_crossentropy.hpp | 119 +- src/ngraph/op/fused/space_to_depth.cpp | 36 +- src/ngraph/op/fused/space_to_depth.hpp | 69 +- src/ngraph/op/fused/split.cpp | 68 +- src/ngraph/op/fused/split.hpp | 99 +- src/ngraph/op/fused/squared_difference.cpp | 16 +- src/ngraph/op/fused/squared_difference.hpp | 54 +- src/ngraph/op/fused/squeeze.hpp | 25 +- src/ngraph/op/fused/unsqueeze.hpp | 27 +- src/ngraph/op/fused_op_tbl.hpp | 61 - src/ngraph/op/gather.hpp | 6 +- src/ngraph/op/gather_nd.hpp | 47 +- src/ngraph/op/gather_tree.cpp | 84 + src/ngraph/op/gather_tree.hpp | 58 + src/ngraph/op/get_output_element.hpp | 52 +- src/ngraph/op/greater.hpp | 6 +- src/ngraph/op/greater_eq.cpp | 12 +- src/ngraph/op/greater_eq.hpp | 19 +- src/ngraph/op/less.hpp | 6 +- src/ngraph/op/less_eq.hpp | 7 +- src/ngraph/op/log.hpp | 37 +- src/ngraph/op/lrn.cpp | 7 - src/ngraph/op/lrn.hpp | 83 +- src/ngraph/op/max.cpp | 1 + src/ngraph/op/max.hpp | 6 +- src/ngraph/op/max_pool.hpp | 12 +- src/ngraph/op/maximum.hpp | 17 +- src/ngraph/op/min.cpp | 1 + src/ngraph/op/min.hpp | 6 +- src/ngraph/op/minimum.hpp | 17 +- src/ngraph/op/multiply.hpp | 18 +- src/ngraph/op/negative.hpp | 40 +- src/ngraph/op/not.hpp | 6 +- src/ngraph/op/not_equal.hpp | 6 +- src/ngraph/op/one_hot.cpp | 89 +- src/ngraph/op/one_hot.hpp | 129 +- src/ngraph/op/op.hpp | 2 +- src/ngraph/op/op_version_tbl.hpp | 243 ++ src/ngraph/op/or.hpp | 8 +- src/ngraph/op/pad.hpp | 6 +- src/ngraph/op/parameter.cpp | 9 + src/ngraph/op/parameter.hpp | 5 +- src/ngraph/op/passthrough.hpp | 19 +- src/ngraph/op/power.hpp | 17 +- src/ngraph/op/product.hpp | 3 +- src/ngraph/op/quantize.hpp | 170 +- src/ngraph/op/quantized_convolution.hpp | 147 +- src/ngraph/op/quantized_dot.hpp | 116 +- src/ngraph/op/recv.hpp | 41 +- src/ngraph/op/reduce_logical_and.cpp | 36 + src/ngraph/op/reduce_logical_and.hpp | 53 + src/ngraph/op/reduce_logical_or.cpp | 36 + src/ngraph/op/reduce_logical_or.hpp | 53 + src/ngraph/op/reduce_mean.hpp | 3 +- src/ngraph/op/reduce_prod.hpp | 5 +- src/ngraph/op/reduce_sum.hpp | 5 +- src/ngraph/op/relu.cpp | 2 +- src/ngraph/op/relu.hpp | 68 +- src/ngraph/op/replace_slice.hpp | 119 +- src/ngraph/op/reshape.cpp | 14 +- src/ngraph/op/reshape.hpp | 104 +- src/ngraph/op/result.hpp | 3 +- src/ngraph/op/reverse.hpp | 6 +- src/ngraph/op/reverse_sequence.cpp | 75 +- src/ngraph/op/reverse_sequence.hpp | 61 +- src/ngraph/op/scatter_add.hpp | 53 +- src/ngraph/op/scatter_nd_add.cpp | 14 +- src/ngraph/op/scatter_nd_add.hpp | 53 +- src/ngraph/op/select.hpp | 51 +- src/ngraph/op/send.hpp | 41 +- src/ngraph/op/sigmoid.cpp | 2 +- src/ngraph/op/sigmoid.hpp | 61 +- src/ngraph/op/sign.hpp | 31 +- src/ngraph/op/sin.hpp | 41 +- src/ngraph/op/sinh.hpp | 37 +- src/ngraph/op/slice.hpp | 3 +- src/ngraph/op/softmax.hpp | 6 +- src/ngraph/op/sqrt.hpp | 41 +- src/ngraph/op/stop_gradient.hpp | 31 +- src/ngraph/op/strided_slice.cpp | 6 - src/ngraph/op/strided_slice.hpp | 3 +- src/ngraph/op/subtract.cpp | 52 +- src/ngraph/op/subtract.hpp | 87 +- src/ngraph/op/sum.hpp | 3 +- src/ngraph/op/tan.hpp | 41 +- src/ngraph/op/tanh.hpp | 37 +- src/ngraph/op/tensor_iterator.cpp | 66 +- src/ngraph/op/tensor_iterator.hpp | 514 ++-- src/ngraph/op/topk.hpp | 6 +- src/ngraph/op/util/activation_functions.cpp | 6 +- src/ngraph/op/util/activation_functions.hpp | 3 +- src/ngraph/op/util/arithmetic_reduction.hpp | 2 +- .../util/arithmetic_reductions_keep_dims.hpp | 2 +- src/ngraph/op/util/attr_types.cpp | 129 +- src/ngraph/op/util/attr_types.hpp | 142 +- .../op/util/binary_elementwise_arithmetic.cpp | 9 +- .../op/util/binary_elementwise_arithmetic.hpp | 14 +- .../op/util/binary_elementwise_comparison.cpp | 6 + .../op/util/binary_elementwise_comparison.hpp | 4 +- .../op/util/binary_elementwise_logical.cpp | 6 + .../op/util/binary_elementwise_logical.hpp | 4 +- src/ngraph/op/util/fused_op.hpp | 2 +- src/ngraph/op/util/index_reduction.cpp | 17 +- src/ngraph/op/util/index_reduction.hpp | 15 +- src/ngraph/op/util/logical_reduction.hpp | 2 +- .../op/util/logical_reduction_keep_dims.cpp | 82 + .../op/util/logical_reduction_keep_dims.hpp | 52 + src/ngraph/op/util/op_annotations.hpp | 3 +- src/ngraph/op/util/rnn_cell_base.hpp | 16 +- .../op/util/unary_elementwise_arithmetic.hpp | 2 +- src/ngraph/op/variadic_split.cpp | 98 + src/ngraph/op/variadic_split.hpp | 59 + src/ngraph/op/xor.hpp | 8 +- src/ngraph/ops.hpp | 184 ++ src/ngraph/opsets/opset.cpp | 38 + src/ngraph/opsets/opset.hpp | 50 + .../{op/op_tbl.hpp => opsets/opset0_tbl.hpp} | 57 +- src/ngraph/opsets/opset1.hpp | 29 + src/ngraph/opsets/opset1_tbl.hpp | 159 ++ src/ngraph/partial_shape.cpp | 2 + src/ngraph/partial_shape.hpp | 20 +- src/ngraph/pass/algebraic_simplification.hpp | 2 +- src/ngraph/pass/batch_fusion.cpp | 84 + src/ngraph/pass/batch_fusion.hpp | 2 +- .../pass/common_function_collection.hpp | 2 +- src/ngraph/pass/concat_fusion.hpp | 4 +- src/ngraph/pass/constant_folding.hpp | 6 +- .../constant_folding_arithmetic_reduction.cpp | 3 + src/ngraph/pass/constant_folding_binary.cpp | 256 +- .../pass/constant_folding_broadcast.cpp | 3 + src/ngraph/pass/constant_folding_concat.cpp | 3 + src/ngraph/pass/constant_folding_convert.cpp | 6 + .../pass/constant_folding_dyn_broadcast.cpp | 3 + .../pass/constant_folding_dyn_reshape.cpp | 6 +- .../pass/constant_folding_dyn_slice.cpp | 3 + src/ngraph/pass/constant_folding_gather.cpp | 58 +- .../constant_folding_logical_reduction.cpp | 43 +- src/ngraph/pass/constant_folding_pad.cpp | 3 + src/ngraph/pass/constant_folding_range.cpp | 3 + src/ngraph/pass/constant_folding_reshape.cpp | 3 + src/ngraph/pass/constant_folding_reverse.cpp | 3 + src/ngraph/pass/constant_folding_select.cpp | 3 + src/ngraph/pass/constant_folding_slice.cpp | 3 + src/ngraph/pass/constant_folding_squeeze.cpp | 3 + .../pass/constant_folding_strided_slice.cpp | 196 ++ .../pass/constant_folding_transpose.cpp | 3 + src/ngraph/pass/constant_folding_unary.cpp | 10 +- .../pass/constant_folding_unsqueeze.cpp | 3 + src/ngraph/pass/constant_to_broadcast.hpp | 2 +- src/ngraph/pass/core_fusion.hpp | 2 +- src/ngraph/pass/cse.hpp | 2 +- src/ngraph/pass/dump_sorted.hpp | 2 +- src/ngraph/pass/dyn_elimination.cpp | 1 + src/ngraph/pass/dyn_elimination.hpp | 2 +- src/ngraph/pass/fused_op_decomposition.hpp | 2 +- .../pass/get_output_element_elimination.hpp | 2 +- src/ngraph/pass/graph_rewrite.hpp | 4 +- .../pass/implicit_broadcast_elimination.hpp | 2 +- src/ngraph/pass/like_replacement.hpp | 2 +- src/ngraph/pass/liveness.hpp | 2 +- src/ngraph/pass/manager.hpp | 2 +- src/ngraph/pass/memory_visualize.hpp | 2 +- src/ngraph/pass/nop_elimination.hpp | 2 +- src/ngraph/pass/opset0_downgrade.cpp | 643 +++-- src/ngraph/pass/opset0_downgrade.hpp | 8 +- src/ngraph/pass/opset1_upgrade.cpp | 687 +++-- src/ngraph/pass/opset1_upgrade.hpp | 8 +- src/ngraph/pass/pass.cpp | 18 + src/ngraph/pass/pass.hpp | 29 +- src/ngraph/pass/propagate_cacheability.hpp | 2 +- src/ngraph/pass/reshape_elimination.hpp | 5 +- src/ngraph/pass/reshape_sinking.hpp | 2 +- src/ngraph/pass/serialize.hpp | 2 +- src/ngraph/pass/shape_relevance.hpp | 2 +- src/ngraph/pass/validate.hpp | 2 +- src/ngraph/pass/validate_graph.hpp | 2 +- src/ngraph/pass/visualize_tree.hpp | 8 +- .../pass/zero_dim_tensor_elimination.hpp | 2 +- src/ngraph/pattern/matcher.cpp | 10 + src/ngraph/pattern/matcher.hpp | 2 +- src/ngraph/pattern/op/any.hpp | 5 +- src/ngraph/pattern/op/any_of.hpp | 5 +- src/ngraph/pattern/op/label.hpp | 5 +- src/ngraph/pattern/op/pattern.hpp | 5 +- src/ngraph/pattern/op/skip.hpp | 5 +- src/ngraph/runtime/aligned_buffer.hpp | 2 +- src/ngraph/runtime/backend.hpp | 2 +- src/ngraph/runtime/cpu/CMakeLists.txt | 6 +- src/ngraph/runtime/cpu/builder/cum_sum.cpp | 158 ++ .../runtime/cpu/builder/matmul_bias.cpp | 3 +- .../runtime/cpu/builder/random_uniform.cpp | 3 + src/ngraph/runtime/cpu/cpu_backend.cpp | 70 + src/ngraph/runtime/cpu/cpu_backend.hpp | 12 + .../runtime/cpu/cpu_builder_registry.cpp | 1 + .../runtime/cpu/cpu_builder_registry.hpp | 1 + src/ngraph/runtime/cpu/cpu_emitter.cpp | 19 +- src/ngraph/runtime/cpu/cpu_emitter.hpp | 148 +- .../runtime/cpu/cpu_external_function.cpp | 8 +- src/ngraph/runtime/cpu/cpu_kernels.hpp | 8 + src/ngraph/runtime/cpu/kernel/convolution.hpp | 12 +- src/ngraph/runtime/cpu/kernel/cum_sum.hpp | 49 + src/ngraph/runtime/cpu/kernel/dot.hpp | 12 +- src/ngraph/runtime/cpu/op/gelu_backprop.cpp | 2 +- .../runtime/cpu/pass/cpu_mat_fusion.cpp | 110 +- .../runtime/cpu/pass/cpu_mat_fusion.hpp | 16 - .../pass/cpu_post_layout_optimizations.cpp | 4 + src/ngraph/runtime/cpu/unit_test.manifest | 2 + src/ngraph/runtime/executable.hpp | 2 +- src/ngraph/runtime/generic_cpu/CMakeLists.txt | 2 +- .../runtime/generic_cpu/gcpu_executable.cpp | 45 +- .../runtime/generic_cpu/gcpu_executable.hpp | 136 +- .../runtime/generic_cpu/kernel/broadcast.hpp | 5 +- src/ngraph/runtime/generic_cpu/kernel/dot.hpp | 5 +- .../runtime/generic_cpu/node_wrapper.hpp | 59 - .../runtime/generic_cpu/unit_test.manifest | 3 +- src/ngraph/runtime/host_tensor.hpp | 2 +- src/ngraph/runtime/interpreter/CMakeLists.txt | 2 +- .../runtime/interpreter/int_executable.cpp | 85 +- .../runtime/interpreter/int_executable.hpp | 202 +- .../runtime/interpreter/node_wrapper.cpp | 47 - .../runtime/interpreter/node_wrapper.hpp | 62 - .../runtime/interpreter/opset_int_tbl.hpp | 27 + src/ngraph/runtime/performance_counter.hpp | 2 +- .../runtime/plaidml/plaidml_compiler.cpp | 11 +- src/ngraph/runtime/plaidml/unit_test.manifest | 17 + src/ngraph/runtime/reference/broadcast.hpp | 24 +- src/ngraph/runtime/reference/cum_sum.hpp | 142 + src/ngraph/runtime/tensor.hpp | 6 +- src/ngraph/serializer.cpp | 2411 +++++++++-------- src/ngraph/shape.cpp | 62 + src/ngraph/shape.hpp | 51 +- src/ngraph/specialize_function.cpp | 2 + src/ngraph/strides.cpp | 58 + src/ngraph/strides.hpp | 50 +- src/ngraph/type.hpp | 30 +- src/ngraph/type/bfloat16.hpp | 4 +- src/ngraph/type/element_type.cpp | 33 +- src/ngraph/type/element_type.hpp | 49 +- src/ngraph/type/float16.cpp | 7 +- src/ngraph/type/float16.hpp | 4 +- src/ngraph/util.hpp | 1 + src/ngraph/validation_util.cpp | 40 + src/ngraph/validation_util.hpp | 45 + src/ngraph/visibility.hpp | 2 +- src/tools/nbench/benchmark_utils.cpp | 1 + src/tools/nbench/nbench.cpp | 37 +- test/CMakeLists.txt | 19 +- test/attributes.cpp | 258 ++ test/backend/api.in.cpp | 52 - test/backend/auto_broadcast.in.cpp | 64 +- test/backend/autodiff.in.cpp | 4 - test/backend/batch_mat_mul.in.cpp | 55 + test/backend/convolution.in.cpp | 12 +- test/backend/cum_sum.in.cpp | 189 ++ test/backend/dyn_reshape.in.cpp | 2 +- test/backend/fused_op.in.cpp | 152 +- test/backend/group_convolution.in.cpp | 128 + test/backend/lrn.in.cpp | 87 + test/backend/one_hot.in.cpp | 21 - test/backend/reverse_sequence.in.cpp | 41 + test/backend/tensorview_custom_mem.in.cpp | 61 - test/backend_api.cpp | 2 +- test/build_graph.cpp | 6 +- test/constant_folding.cpp | 210 +- test/control_dependencies.cpp | 3 + test/convert_u1_to_string.cpp | 35 + test/core_fusion.cpp | 55 + test/cpu_fusion.cpp | 71 +- test/cpu_test.cpp | 105 + test/float16.cpp | 16 +- test/mlir/affine_conversion/core_ops.mlir | 19 + test/mlir/ngraph_dialect/fused_ops.mlir | 322 +++ test/mlir/ngraph_dialect/types.mlir | 86 +- test/models/onnx/cum_sum_1d.prototxt | 49 + .../onnx/cum_sum_2d_axis_input.prototxt | 69 + .../cum_sum_2d_dynamic_axis_input.prototxt | 64 + .../cum_sum_3d_exclusive_reverse.prototxt | 61 + test/models/onnx/matmul_float.prototxt | 69 + test/models/onnx/mod_sign.prototxt | 58 + test/onnx/onnx_import.in.cpp | 73 + test/opset1.cpp | 144 + .../binary_elementwise_opset_pass.cpp | 39 +- test/opset_pass/broadcast_opset_pass.cpp | 23 +- test/opset_pass/convolution_opset_pass.cpp | 22 +- test/opset_pass/dyn_reshape_opset_pass.cpp | 15 +- test/opset_pass/gather_opset_pass.cpp | 8 +- test/opset_pass/generate_mask_opset_pass.cpp | 6 +- test/opset_pass/logical_and_opset_pass.cpp | 12 +- test/opset_pass/logical_not_opset_pass.cpp | 12 +- test/opset_pass/logical_or_opset_pass.cpp | 12 +- test/opset_pass/logical_xor_opset_pass.cpp | 12 +- test/opset_pass/one_hot_opset_pass.cpp | 129 + test/opset_pass/pad_opset_pass.cpp | 12 +- test/opset_pass/poolings_opset_pass.cpp | 106 +- test/opset_pass/product_opset_pass.cpp | 17 +- test/opset_pass/reverse_opset_pass.cpp | 18 +- test/opset_pass/slice_opset_pass.cpp | 11 +- test/opset_pass/softmax_opset_pass.cpp | 46 +- test/opset_pass/sum_opset_pass.cpp | 17 +- test/opset_pass/topk_opset_pass.cpp | 10 +- test/pattern.cpp | 4 +- test/serialize.cpp | 206 +- test/type_prop/batch_mat_mul_transpose.cpp | 212 ++ test/type_prop/convolution.cpp | 24 +- test/type_prop/crop_and_resize.cpp | 81 + test/type_prop/deformable_psroi_pooling.cpp | 131 + test/type_prop/gather_tree.cpp | 134 + test/type_prop/hard_sigmoid.cpp | 11 +- .../type_prop/log_softmax.cpp | 36 +- test/type_prop/lrn.cpp | 17 - test/type_prop/one_hot.cpp | 164 ++ test/type_prop/reverse_sequence.cpp | 52 +- test/type_prop/space_to_depth.cpp | 22 +- test/type_prop/split.cpp | 57 +- test/type_prop/squared_difference.cpp | 2 +- test/type_prop/unary_elementwise.cpp | 8 + test/util/CMakeLists.txt | 1 + test/util/matcher.hpp | 3 +- 583 files changed, 20359 insertions(+), 8536 deletions(-) create mode 100644 doc/examples/dynamic_tensor/partial_shape.cpp create mode 100644 doc/sphinx/source/core/quantization.rst create mode 100644 doc/sphinx/source/dynamic/index.rst rename doc/sphinx/source/frameworks/{other.rst => other/index.rst} (93%) delete mode 100644 doc/sphinx/source/graphics/ExecutionInterfaceRunGraphs.png delete mode 100644 doc/sphinx/source/graphics/dl-current-state.png delete mode 100644 doc/sphinx/source/graphics/dl-current-state.xcf create mode 100644 doc/sphinx/source/graphics/execution-interface-run-graph.svg delete mode 100644 doc/sphinx/source/graphics/paddlepaddle_design.png create mode 100644 doc/sphinx/source/graphics/paddlepaddle_design.svg delete mode 100644 doc/sphinx/source/graphics/scalability-matters.png delete mode 100644 doc/sphinx/source/graphics/scalability-matters.xcf delete mode 100644 doc/sphinx/source/graphics/simple-compiler-passes.png create mode 100644 doc/sphinx/source/graphics/simple-compiler-passes.svg create mode 100644 doc/sphinx/source/training/data_ingest.rst create mode 100644 doc/sphinx/source/training/index.rst create mode 100644 doc/sphinx/source/training/overview.rst create mode 100644 doc/sphinx/source/training/paddle_dist.rst create mode 100644 doc/sphinx/source/training/qat.rst create mode 100644 doc/sphinx/source/training/tf_dist.rst create mode 100644 src/ngraph/attribute_adapter.cpp create mode 100644 src/ngraph/attribute_adapter.hpp create mode 100644 src/ngraph/attribute_visitor.hpp create mode 100644 src/ngraph/enum_names.hpp create mode 100644 src/ngraph/factory.cpp create mode 100644 src/ngraph/factory.hpp rename src/ngraph/frontend/onnx_import/op/{matmul.cpp => cum_sum.cpp} (53%) create mode 100644 src/ngraph/frontend/onnx_import/op/cum_sum.hpp create mode 100644 src/ngraph/frontend/onnx_import/op/log_softmax.cpp create mode 100644 src/ngraph/frontend/onnx_import/op/mod.cpp create mode 100644 src/ngraph/frontend/onnx_import/op/mod.hpp create mode 100644 src/ngraph/op/convert_like.cpp create mode 100644 src/ngraph/op/convert_like.hpp create mode 100644 src/ngraph/op/crop_and_resize.cpp create mode 100644 src/ngraph/op/crop_and_resize.hpp create mode 100644 src/ngraph/op/cum_sum.cpp create mode 100644 src/ngraph/op/cum_sum.hpp create mode 100644 src/ngraph/op/deformable_psroi_pooling.cpp create mode 100644 src/ngraph/op/deformable_psroi_pooling.hpp create mode 100644 src/ngraph/op/floor_mod.cpp create mode 100644 src/ngraph/op/floor_mod.hpp rename src/ngraph/{runtime/cpu/op => op/fused}/batch_mat_mul_transpose.cpp (67%) rename src/ngraph/{runtime/cpu/op => op/fused}/batch_mat_mul_transpose.hpp (91%) create mode 100644 src/ngraph/op/fused/crossentropy.cpp create mode 100644 src/ngraph/op/fused/crossentropy.hpp create mode 100644 src/ngraph/op/fused/log_softmax.cpp create mode 100644 src/ngraph/op/fused/log_softmax.hpp create mode 100644 src/ngraph/op/fused/mod.cpp create mode 100644 src/ngraph/op/fused/mod.hpp create mode 100644 src/ngraph/op/fused/reciprocal.cpp create mode 100644 src/ngraph/op/fused/reciprocal.hpp delete mode 100644 src/ngraph/op/fused_op_tbl.hpp create mode 100644 src/ngraph/op/gather_tree.cpp create mode 100644 src/ngraph/op/gather_tree.hpp create mode 100644 src/ngraph/op/op_version_tbl.hpp create mode 100644 src/ngraph/op/reduce_logical_and.cpp create mode 100644 src/ngraph/op/reduce_logical_and.hpp create mode 100644 src/ngraph/op/reduce_logical_or.cpp create mode 100644 src/ngraph/op/reduce_logical_or.hpp create mode 100644 src/ngraph/op/util/logical_reduction_keep_dims.cpp create mode 100644 src/ngraph/op/util/logical_reduction_keep_dims.hpp create mode 100644 src/ngraph/op/variadic_split.cpp create mode 100644 src/ngraph/op/variadic_split.hpp create mode 100644 src/ngraph/ops.hpp create mode 100644 src/ngraph/opsets/opset.cpp create mode 100644 src/ngraph/opsets/opset.hpp rename src/ngraph/{op/op_tbl.hpp => opsets/opset0_tbl.hpp} (74%) create mode 100644 src/ngraph/opsets/opset1.hpp create mode 100644 src/ngraph/opsets/opset1_tbl.hpp create mode 100644 src/ngraph/pass/constant_folding_strided_slice.cpp create mode 100644 src/ngraph/runtime/cpu/builder/cum_sum.cpp create mode 100644 src/ngraph/runtime/cpu/kernel/cum_sum.hpp delete mode 100644 src/ngraph/runtime/generic_cpu/node_wrapper.hpp delete mode 100644 src/ngraph/runtime/interpreter/node_wrapper.cpp delete mode 100644 src/ngraph/runtime/interpreter/node_wrapper.hpp create mode 100644 src/ngraph/runtime/interpreter/opset_int_tbl.hpp create mode 100644 src/ngraph/runtime/reference/cum_sum.hpp create mode 100644 test/attributes.cpp create mode 100644 test/backend/cum_sum.in.cpp create mode 100644 test/backend/group_convolution.in.cpp delete mode 100644 test/backend/tensorview_custom_mem.in.cpp create mode 100644 test/convert_u1_to_string.cpp create mode 100644 test/mlir/ngraph_dialect/fused_ops.mlir create mode 100644 test/models/onnx/cum_sum_1d.prototxt create mode 100644 test/models/onnx/cum_sum_2d_axis_input.prototxt create mode 100644 test/models/onnx/cum_sum_2d_dynamic_axis_input.prototxt create mode 100644 test/models/onnx/cum_sum_3d_exclusive_reverse.prototxt create mode 100644 test/models/onnx/matmul_float.prototxt create mode 100644 test/models/onnx/mod_sign.prototxt create mode 100644 test/opset1.cpp create mode 100644 test/opset_pass/one_hot_opset_pass.cpp create mode 100644 test/type_prop/batch_mat_mul_transpose.cpp create mode 100644 test/type_prop/crop_and_resize.cpp create mode 100644 test/type_prop/deformable_psroi_pooling.cpp create mode 100644 test/type_prop/gather_tree.cpp rename src/ngraph/runtime/generic_cpu/node_wrapper.cpp => test/type_prop/log_softmax.cpp (53%) diff --git a/.ci/onnx/jenkins/Jenkinsfile b/.ci/onnx/jenkins/Jenkinsfile index ecdcaa77e60..ac7b6f64e40 100644 --- a/.ci/onnx/jenkins/Jenkinsfile +++ b/.ci/onnx/jenkins/Jenkinsfile @@ -113,10 +113,10 @@ pipeline { WORKDIR = "${WORKSPACE}/${BUILD_NUMBER}" JENKINS_GITHUB_CREDENTIAL_ID = "7157091e-bc04-42f0-99fd-dc4da2922a55" CI_DIR = "ngraph-onnx/.ci/jenkins" - NGRAPH_ONNX_REPO_ADDRESS = "https://github.com/NervanaSystems/ngraph-onnx.git" - NGRAPH_REPO_ADDRESS = "https://github.com/NervanaSystems/ngraph.git" - NGRAPH_ONNX_BRANCH="${CHANGE_BRANCH}" - NGRAPH_BRANCH="${CHANGE_BRANCH}" + NGRAPH_ONNX_REPO_ADDRESS = "git@github.com:NervanaSystems/ngraph-onnx.git" + NGRAPH_REPO_ADDRESS = "git@github.com:NervanaSystems/ngraph.git" + NGRAPH_ONNX_BRANCH = "${CHANGE_BRANCH}" + NGRAPH_BRANCH = "${CHANGE_BRANCH}" } options { skipDefaultCheckout true diff --git a/CMakeLists.txt b/CMakeLists.txt index 39d2992bcd9..269e14804ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,14 +69,6 @@ if (UNIX AND NOT APPLE) set(LINUX TRUE) endif() -if ("${CMAKE_GENERATOR}" MATCHES "^Visual Studio.*$") - set(MSVS TRUE) -endif() - -if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) - add_definitions(/bigobj) -endif() - # APPLE: Set CMAKE_OSX_SYSROOT if not set already. if (APPLE) execute_process(COMMAND sw_vers -productVersion @@ -151,7 +143,7 @@ if (CMAKE_OSX_SYSROOT) ) endif() -if (NOT MSVS) +if (NOT MSVC) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE) endif() @@ -361,7 +353,16 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(Apple)?Clang$" AND NOT NGRAPH_BUILD_DI endif() if (WIN32) - set(CMAKE_CXX_FLAGS "/W0 /EHsc /MP") + string(REPLACE "/W3" "/W0" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /MP") + + if (CMAKE_CXX_COMPILER_ID MATCHES MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") + # C4251 needs to have dll-interface to be used by clients of class + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251") + # C4275 non dll-interface class used as base for dll-interface class + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275") + endif() else() set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") @@ -461,36 +462,36 @@ if (NOT DEFINED NGRAPH_TBB_ENABLE) set(NGRAPH_TBB_ENABLE ${NGRAPH_CPU_ENABLE}) endif() -# Since UNIX and APPLE support Bash we can use a Bash script to do the clang-format functions +# Since UNIX support Bash we can use a Bash script to do the clang-format functions # This is much faster than the cmake method -if (UNIX OR APPLE) +if (UNIX) add_custom_target(style-check COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/maint/check-code-format.sh) add_custom_target(style-apply COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/maint/apply-code-format.sh) add_custom_target(style COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/maint/apply-code-format.sh) else() add_custom_target(style-check COMMAND ${CMAKE_COMMAND} - -DNGRAPH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" - -P ${CMAKE_MODULE_PATH}style_check.cmake + -DNGRAPH_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/style_check.cmake ) add_custom_target(style-apply COMMAND ${CMAKE_COMMAND} - -DNGRAPH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" - -P ${CMAKE_MODULE_PATH}style_apply.cmake + -DNGRAPH_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/style_apply.cmake ) add_custom_target(style COMMAND ${CMAKE_COMMAND} - -DNGRAPH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" - -P ${CMAKE_MODULE_PATH}style_apply.cmake + -DNGRAPH_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/style_apply.cmake ) endif() add_custom_target(fix-mode COMMAND ${CMAKE_COMMAND} - -DNGRAPH_SOURCE_DIR="${CMAKE_SOURCE_DIR}" - -P ${CMAKE_MODULE_PATH}fix_mode.cmake + -DNGRAPH_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" + -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/fix_mode.cmake ) #----------------------------------------------------------------------------------------------- @@ -545,13 +546,13 @@ if(NOT DEFINED EXTERNAL_PROJECTS_ROOT) endif() if (NGRAPH_ONNX_IMPORT_ENABLE) - if (MSVS) + if (MSVC) # When we build dll libraries. These flags make sure onnx and protobuf build with /MD, not /MT. # These two options can't be mixed, because they requires link two imcompatiable runtime. set(ONNX_USE_MSVC_STATIC_RUNTIME OFF) set(protobuf_WITH_ZLIB OFF CACHE BOOL "" FORCE) set(protobuf_MSVC_STATIC_RUNTIME OFF CACHE BOOL "Link protobuf to static runtime libraries" FORCE) - endif(MSVS) + endif() if (NOT NGRAPH_USE_SYSTEM_PROTOBUF) include(cmake/external_protobuf.cmake) else() @@ -591,7 +592,7 @@ endif() if(NGRAPH_CODEGEN_ENABLE) if (NGRAPH_USE_PREBUILT_LLVM OR DEFINED LLVM_TARBALL_URL) include(cmake/external_llvm_prebuilt.cmake) - elseif (NOT MSVS) + elseif (NOT MSVC) include(cmake/external_llvm.cmake) else() message(FATAL_ERROR "CODEGEN is not supported on Windows!") diff --git a/cmake/Modules/fix_mode.cmake b/cmake/Modules/fix_mode.cmake index 2f781befea3..53ac0ae73a8 100644 --- a/cmake/Modules/fix_mode.cmake +++ b/cmake/Modules/fix_mode.cmake @@ -16,7 +16,8 @@ function(MODE_APPLY_FILE PATH) execute_process(COMMAND git update-index --add --chmod=-x ${PATH} - OUTPUT_VARIABLE RESULT) + OUTPUT_VARIABLE RESULT + ERROR_QUIET) endfunction() set(DIRECTORIES_OF_INTEREST diff --git a/cmake/external_gtest.cmake b/cmake/external_gtest.cmake index f16cebaec8b..4b98360b57c 100644 --- a/cmake/external_gtest.cmake +++ b/cmake/external_gtest.cmake @@ -35,6 +35,12 @@ if(WIN32) ) endif() +if(CMAKE_BUILD_TYPE) + list(APPEND GTEST_CMAKE_ARGS + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + ) +endif() + if(UNIX) # workaround for compile error # related: https://github.com/intel/mkl-dnn/issues/55 @@ -43,6 +49,17 @@ else() set(GTEST_CXX_FLAGS ${CMAKE_CXX_FLAGS}) endif() +#Build for ninja +if(UNIX) + SET(GTEST_PATHS ${CMAKE_BINARY_DIR}/ngraph/gtest/build/googlemock/gtest/libgtest.a + ${CMAKE_BINARY_DIR}/ngraph/gtest/build/googlemock/libgmock.a) +else() + SET(GTEST_PATHS ${CMAKE_BINARY_DIR}/ngraph/gtest/build/googlemock/gtest/gtest.lib + ${CMAKE_BINARY_DIR}/ngraph/gtest/build/googlemock/gtest/gmock.lib + ${CMAKE_BINARY_DIR}/ngraph/gtest/build/googlemock/gtest/gtestd.lib + ${CMAKE_BINARY_DIR}/ngraph/gtest/build/googlemock/gtest/gmockd.lib) +endif() + ExternalProject_Add( ext_gtest PREFIX gtest @@ -60,6 +77,7 @@ ExternalProject_Add( ${GTEST_CMAKE_ARGS} BINARY_DIR "${EXTERNAL_PROJECTS_ROOT}/gtest/build" EXCLUDE_FROM_ALL TRUE + BUILD_BYPRODUCTS ${GTEST_PATHS} ) #------------------------------------------------------------------------------ diff --git a/cmake/external_mlir.cmake b/cmake/external_mlir.cmake index 3aa46a7cacf..5cb841fda87 100644 --- a/cmake/external_mlir.cmake +++ b/cmake/external_mlir.cmake @@ -20,8 +20,8 @@ set(MLIR_LLVM_REPO_URL https://github.com/llvm/llvm-project.git) set(MLIR_REPO_URL https://github.com/tensorflow/mlir.git) # Change these commit IDs to move to latest stable versions -set(MLIR_LLVM_COMMIT_ID 0845ac7331e) -set(MLIR_COMMIT_ID 1f7893e0) +set(MLIR_LLVM_COMMIT_ID e0f1d9d8729) +set(MLIR_COMMIT_ID c61db4bb) # MLIR environment variables. Some of them are used by LIT tool. set(MLIR_PROJECT_ROOT ${CMAKE_CURRENT_BINARY_DIR}/mlir_project) diff --git a/cmake/external_protobuf.cmake b/cmake/external_protobuf.cmake index bea4561a9b4..bf99662bda8 100644 --- a/cmake/external_protobuf.cmake +++ b/cmake/external_protobuf.cmake @@ -23,7 +23,12 @@ include(ExternalProject) # This version of PROTOBUF is required by Microsoft ONNX Runtime. set(NGRAPH_PROTOBUF_GIT_REPO_URL "https://github.com/protocolbuffers/protobuf") -set(NGRAPH_PROTOBUF_GIT_TAG "v3.5.2") + +if(NGRAPH_ONNX_IMPORT_ENABLE) + set(NGRAPH_PROTOBUF_GIT_TAG "v3.5.2") +else() + set(NGRAPH_PROTOBUF_GIT_TAG "v3.6.1") +endif() if (WIN32) ExternalProject_Add( @@ -103,14 +108,32 @@ if (WIN32) else() set(Protobuf_LIBRARY ${Protobuf_INSTALL_PREFIX}/lib/libprotobuf.a) endif() -set(Protobuf_LIBRARIES ${Protobuf_LIBRARY}) -if (NOT TARGET protobuf::libprotobuf) - add_library(protobuf::libprotobuf UNKNOWN IMPORTED) - set_target_properties(protobuf::libprotobuf PROPERTIES - INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}" - IMPORTED_LOCATION "${Protobuf_LIBRARY}") - add_dependencies(protobuf::libprotobuf ext_protobuf) +if(NGRAPH_ONNX_IMPORT_ENABLE) + if (NOT TARGET libprotobuf) + add_library(libprotobuf INTERFACE) + if (WIN32) + target_link_libraries(libprotobuf INTERFACE + debug ${Protobuf_INSTALL_PREFIX}/lib/libprotobufd.lib + optimized ${Protobuf_INSTALL_PREFIX}/lib/libprotobuf.lib) + else() + target_link_libraries(libprotobuf INTERFACE + ${Protobuf_INSTALL_PREFIX}/lib/libprotobuf.a) + endif() + set_target_properties(libprotobuf PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}") + add_dependencies(libprotobuf ext_protobuf) + endif() + set(Protobuf_LIBRARIES libprotobuf) +else() + if (NOT TARGET protobuf::libprotobuf) + add_library(protobuf::libprotobuf UNKNOWN IMPORTED) + set_target_properties(protobuf::libprotobuf PROPERTIES + INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}" + IMPORTED_LOCATION "${Protobuf_LIBRARY}") + add_dependencies(protobuf::libprotobuf ext_protobuf) + endif() + set(Protobuf_LIBRARIES protobuf::libprotobuf) endif() if (NOT TARGET protobuf::protoc) diff --git a/doc/examples/dynamic_tensor/partial_shape.cpp b/doc/examples/dynamic_tensor/partial_shape.cpp new file mode 100644 index 00000000000..f7bb4acdc75 --- /dev/null +++ b/doc/examples/dynamic_tensor/partial_shape.cpp @@ -0,0 +1,68 @@ +//***************************************************************************** +// Copyright 2017-2019 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//***************************************************************************** + +#include + +#include + +using namespace ngraph; + +int main() +{ + // Create and compile a graph where the provided info of shape of x is + // (2,?) + auto x_shape_info = PartialShape{2, Dimension::dynamic()}; + auto x = make_shared(element::i32, x_shape_info); + auto a = x + x; + auto f = make_shared({a}, {x}); + auto be = runtime::backend::create(); + auto ex = be->compile(f); + + // Create a dynamic tensor of shape (2,?) + auto t_out = be->create_dynamic_tensor(element::i32, x_shape_info); + + // Call the graph to write a value with shape (2,3) to t_out + auto t_in = be->create_tensor(element::i32, Shape{2, 3}); + t_in->write(); + ex->call({t_out}, {t_in}) + + // Call the graph again, to write a value with a different shape to + // t_out. + t_in = be->create_tensor(element::i32, Shape{2, 20}); + t_in->write(); + ex->call({t_out}, {t_in}) + + // Get the result. At this point t_out->get_shape() would return + // Shape{2,20}, + // but t_out->get_partial_shape() would return "(2,?)" + + float r[2][3]; + t_result->read(&r, 0, sizeof(r)); + + std::cout << "[" << std::endl; + for (size_t i = 0; i < s[0]; ++i) + { + std::cout << " ["; + for (size_t j = 0; j < s[1]; ++j) + { + std::cout << r[i][j] << ' '; + } + std::cout << ']' << std::endl; + } + std::cout << ']' << std::endl; + + return 0; +} diff --git a/doc/sphinx/ngraph_theme/layout.html b/doc/sphinx/ngraph_theme/layout.html index ea95cba18f6..abc80193f8a 100644 --- a/doc/sphinx/ngraph_theme/layout.html +++ b/doc/sphinx/ngraph_theme/layout.html @@ -38,7 +38,9 @@ {% endif %} - + + + {% for cssfile in css_files %} @@ -84,14 +86,13 @@ + diff --git a/doc/sphinx/ngraph_theme/ngversions.html b/doc/sphinx/ngraph_theme/ngversions.html index 52f685d46bb..cdc30be0d4b 100644 --- a/doc/sphinx/ngraph_theme/ngversions.html +++ b/doc/sphinx/ngraph_theme/ngversions.html @@ -2,16 +2,15 @@ nGraph Compiler stack v: {{ version }} - +
-
{{ _('Recent Versions') }}
+
{{ _('Recent Versions') }}