Skip to content

CNTK Library API

Amit Agarwal edited this page Oct 25, 2016 · 33 revisions

Python API

CNTK Python API consists of abstractions for model definition and compute, learning algorithms, data reading and distributed training. These abstractions orthogonally compose offering both flexibility and conciseness in definition and training of arbitrary neural networks. Simple yet efficient data interfaces to the compute engine allow users to efficiently feed data in the form of native numpy arrays to the compute engine. Additionally, CNTKs built-in efficient and scalable data readers for Image, text format and speech HTK data formats are also available from the python APIs for ease of directly training with existing data in the supported formats without users having to author any data reading code.

The API includes a high level layers library that enables concisely defining advanced neural networks including recurrences.

The API exposes CNTK's highly scalable distributed training capabilities (parallelization algorithms like 1Bit SGD) in a very easy to use form. The distributed training example illustrates the distributed training API.

The API introduces a new Protocol Buffers based model serialization format which supports backwards and upwards compatibility for saved models.

CNTK supports representation of recurrent models in symbolic form as cycles in the neural network instead of requiring static unrolling of the recurrence steps. This results in much more general, concise and efficient representation and execution of recurrent neural networks with CNTK. The symbolic recurrence representation form is also exposed in the Python API similar to CNTK v1.

All the core computation, learning, and data reading API abstractions in the CNTK python API are very easily extensible from both Python and C++ allowing users to easily implement new operators, learners and data readers which freely compose with the built-in facilities of the library. The extensibility features are not available in the initial Beta release and will become available in subsequent updates in a few weeks.

C++ API

CNTK's core computational, neural network composition & training, efficient data reading capabilities, and scalable model training facilities are all available as part of the V2 C++ library. The C++ APIs are fully featured for both model training as well as evaluation, allowing both training and model serving to be driven from native code. This enables your native model serving code, to also simultaneously refine your models online by tuning them using new data that is seen as part of serving requests (i.e. online learning).

The release includes examples illustrating the use of the C++ APIs for evaluating previously trained CNTK models. We are also actively working on creating model C++ examples illustrating how model training can be performed using the native C++ API and these will become available in a few weeks.

Currently the best source of documentation for the API is the inline documentation in the API header file (CNTKLibrary.h) that contains the full C++ API definition.

Clone this wiki locally