Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

CNTK

> 编程语言
Open source

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit

17.6K stars0 likes3 views
WebsiteGitHub

About

Microsoft Cognitive Toolkit (CNTK), an open source deep-learning toolkit

CNTK

Chat Windows build status Linux build status

The Microsoft Cognitive Toolkit (https://cntk.ai) is a unified deep learning toolkit that describes neural networks as a series of computational steps via a directed graph. In this directed graph, leaf nodes represent input values or network parameters, while other nodes represent matrix operations upon their inputs. CNTK allows users to easily realize and combine popular model types such as feed-forward DNNs, convolutional nets (CNNs), and recurrent networks (RNNs/LSTMs). It implements stochastic gradient descent (SGD, error backpropagation) learning with automatic differentiation and parallelization across multiple GPUs and servers. CNTK has been available under an open-source license since April 2015. It is our hope that the community will take advantage of CNTK to share ideas more quickly through the exchange of open source working code.

Installation

  • Setup CNTK
    • Windows (Python-only / Script-driven / Manual)
    • Linux (Python-only / Script-driven / Manual / Docker)
  • CNTK backend for Keras
  • Setup CNTK development environment
    • Windows (Script-driven / Manual)
    • Linux (Manual)

Installing nightly packages

If you prefer to use latest CNTK bits from master, use one of the CNTK nightly packages:

  • Nightly packages for Windows
  • Nightly packages for Linux

Learning CNTK

You can learn more about using and contributing to CNTK with the following resources:

  • General documentation
  • Python API documentation
  • Evaluation documentation (C++, C#/.NET, Python, Java)
  • Manual
  • Tutorials
  • Examples
  • Pretrained models
  • Blog
  • Presentations
  • License

More information

  • Contribute to CNTK
  • FAQ
  • Feedback

Disclaimer

Dear community,

With our ongoing contributions to ONNX and the ONNX Runtime, we have made it easier to interoperate within the AI framework ecosystem and to access high performance, cross-platform inferencing capabilities for both traditional ML models and deep neural networks. Over the last few years we have been privileged to develop such key open-source machine learning projects, including the Microsoft Cognitive Toolkit, which has enabled its users to leverage industry-wide advancements in deep learning at scale.

Today’s 2.7 release will be the last main release of CNTK. We may have some subsequent minor releases for bug fixes, but these will be evaluated on a case-by-case basis. There are no plans for new feature development post this release.

The CNTK 2.7 release has full support for ONNX 1.4.1, and we encourage those seeking to operationalize their CNTK models to take advantage of ONNX and the ONNX Runtime. Moving forward, users can continue to leverage evolving ONNX innovations via the number of frameworks that support it. For example, users can natively export ONNX models from PyTorch or convert TensorFlow models to ONNX with the TensorFlow-ONNX converter.

We are incredibly grateful for all the support we have received from contributors and users over the years since the initial open-source release of CNTK. CNTK has enabled both Microsoft teams and external users to execute complex and large-scale workloads in all manner of deep learning applications, such as historical breakthroughs in speech recognition achieved by Microsoft Speech researchers, the originators of the framework.

As ONNX is increasingly employed in serving models used across Microsoft products such as Bing and Office, we are dedicated to synthesizing innovations from research with the rigorous demands of production to progress the ecosystem forward.

Above all, our goal is to make innovations in deep learning across the software and hardware stacks as open and accessible as possible. We will be working hard to bring both the existing strengths of CNTK and new state-of-the-art research into other open-source projects to truly broaden the reach of such technologies.

With gratitude,

-- The CNTK Team

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

News

You can find more news on the official project feed

2019-03-29. CNTK 2.7.0

Highlights of this release

  • Moved to CUDA 10 for both Windows and Linux.
  • Support advance RNN loop in ONNX export.
  • Export larger than 2GB models in ONNX format.
  • Support FP16 in Brain Script train action.

CNTK support for CUDA 10

CNTK now supports CUDA 10. This requires an update to build environment to Visual Studio 2017 v15.9 for Windows.

To setup build and runtime environment on Windows:

  • Install Visual Studio 2017. Note: going forward for CUDA 10 and beyond, it is no longer required to install and run with the specific VC Tools version 14.11.
  • Install Nvidia CUDA 10
  • From PowerShell, run: DevInstall.ps1
  • Start Visual Studio 2017 and open CNTK.sln.

To setup build and runtime environment on Linux using docker, please build Unbuntu 16.04 docker image using Dockerfiles here. For other Linux systems, please refer to the Dockerfiles to setup dependent libraries for CNTK.

Support advance RNN loop in ONNX export

CNTK models with recursive loops can be exported to ONNX models with scan ops.

Export larger than 2GB models in ONNX format

To export models larger than 2GB in ONNX format, use cntk.Function API: save(self, filename, format=ModelFormat.CNTKv2, use_external_files_to_store_parameters=False) with 'format' set to ModelFormat.ONNX and use_external_files_to_store_parameters set to True. In this case, model parameters are saved in external files. Exported models shall be used with external parameter files when doing model evaluation with onnxruntime.

2018-11-26.
Netron now supports visualizing CNTK v1 and CNTK v2 .model files.

Project changelog

2018-09-17. CNTK 2.6.0

Efficient group convolution

The implementation of group convolution in CNTK has been updated. The updated implementation moves away from creating a sub-graph for group convolution (using slicing and splicing), and instead uses cuDNN7 and MKL2017 APIs directly. This improves the experience both in terms of performance and model size.

As an example, for a single group convolution op with the following attributes:

  • Input tensor (C, H, W) = (32, 128, 128)
  • Number of output channels = 32 (channel multiplier is 1)
  • Groups = 32 (depth wise convolution)
  • Kernel size = (5, 5)

The comparison numbers for this single node are as follows:

First Header GPU exec. time (in millisec., 1000 run avg.) CPU exec. time (in millisec., 1000 run avg.) Model Size (in KB, CNTK format)
Old implementation 9.349 41.921 38
New implementation 6.581 9.963 5
Speedup/savings Approx. 30% Approx. 65-75% Approx. 87%

Sequential Convolution

The implementation of sequential convolution in CNTK has been updated. The updated implementation creates a separate sequential convolution layer. Different from regular convolution layer, this operation convolves also on the dynamic axis(sequence), and filter_shape[0] is applied to that axis. The updated implementation supports broader cases, such as where stride > 1 for the sequence axis.

For example, a sequential convolution over a batch of one-channel black-and-white images. The images have the same fixed height of 640, but each with width of variable lengths. The width is then represented by sequential axis. Padding is enabled, and strides for both width and height are 2.

 >>> f = SequentialConvolution((3,3), reduction_rank=0, pad=True, strides=(2,2), activation=C.relu)
 >>> x = C.input_variable(**Sequence[Tensor[640]])
 >>> x.shape
     (640,)
 >>> h = f(x)
 >>> h.shape
     (320,)
 >>> f.W.shape
     (1, 1, 3, 3)

Operators

depth_to_space and space_to_depth

There is a breaking change in the depth_to_space and space_to_depth operators. These have been updated to match ONNX specification, specifically the permutation for how the depth dimension is placed as blocks in the spatial dimensions, and vice-versa, has been changed. Please refer to the updated doc examples for these two ops to see the change.

Tan and Atan

Added support for trigonometric ops Tan and Atan.

ELU

Added support for alpha attribute in ELU op.

Convolution

Updated auto padding algorithms of Convolution to produce symmetric padding at best effort on CPU, without affecting the final convolution output values. This update increases the range of cases that could be covered by MKL API and improves the performance, E.g. ResNet50.

Default arguments order

There is a breaking change in the arguments property in CNTK python API. The default behavior has been updated to return arguments in python order instead of in C++ order. This way it will return arguments in the same order as they are fed into ops. If you wish to still get arguments in C++ order, you can simply override the global option. This change should only affect the following ops: Times, TransposeTimes, and Gemm(internal).

Bug fixes

  • Updated doc for Convolution layer to include group and dilation arguments.
  • Added improved input validation for group convolution.
  • Updated LogSoftMax to use more numerically s

Issues· 839 open

View all issuesOpen on GitHub
  • #3873

    API document issue due to syntax in source code

    Updated Mar 10, 2025
  • #3865

    how to install in python3.8

    Updated Jun 15, 2024
  • #2635

    Issue saving and reading function named using Function.SetName

    Updated Jan 5, 2024
  • #3885

    when shape contains negative integer, input_variable should throw an error

    Updated Dec 13, 2023
  • #3886

    MAX_POOLING crash, when pooling_window_shape contains 0

    Updated Dec 9, 2023
  • #3884

    program crash when get gradient of `ConvolutionTranspose2D`

    Updated Dec 8, 2023
  • #3883

    ConvolutionTranspose2D outputs normally when num_filters is tuple and dilation is 0

    Updated Dec 8, 2023
  • #3882

    cntk crash and pycharm process finished with exit code -1066598274 (0xC06D007E)

    Updated Dec 8, 2023
  • #1371

    Implementation of a random sampling node -> minibatch layout troubles

    help wantedUpdated Sep 9, 2023
  • #3879

    development of a neural network for object search

    Updated Mar 28, 2023

> Tags

C++c-plus-plusc-sharpcntkcognitive-toolkit

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedOct 1, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言