1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
|
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="http://keras.io/contributing/">
<link rel="shortcut icon" href="../img/favicon.ico">
<title>Contributing - Keras Documentation</title>
<link href='https://fonts.googleapis.com/css?family=Lato:400,700|Source+Sans+Pro:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../css/theme.css" type="text/css" />
<link rel="stylesheet" href="../css/theme_extra.css" type="text/css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
<script>
// Current page data
var mkdocs_page_name = "Contributing";
var mkdocs_page_input_path = "contributing.md";
var mkdocs_page_url = "/contributing/";
</script>
<script src="../js/jquery-2.1.1.min.js" defer></script>
<script src="../js/modernizr-2.8.3.min.js" defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-61785484-1', 'keras.io');
ga('send', 'pageview');
</script>
</head>
<body class="wy-body-for-nav" role="document">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side stickynav">
<div class="wy-side-scroll">
<a href="">
<div class="keras-logo">
<img src="/img/keras-logo-small.jpg" class="keras-logo-img">
Keras Documentation
</div>
</a>
<div class="wy-side-nav-search">
<div role="search">
<form id ="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" title="Type search term here" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul>
<li class="toctree-l1"><a class="reference internal" href="..">Home</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../why-use-keras/">Why use Keras</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Getting started</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../getting-started/sequential-model-guide/">Guide to the Sequential model</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../getting-started/functional-api-guide/">Guide to the Functional API</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../getting-started/faq/">FAQ</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Models</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../models/about-keras-models/">About Keras models</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../models/sequential/">Sequential</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../models/model/">Model (functional API)</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Layers</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../layers/about-keras-layers/">About Keras layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/core/">Core Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/convolutional/">Convolutional Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/pooling/">Pooling Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/local/">Locally-connected Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/recurrent/">Recurrent Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/embeddings/">Embedding Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/merge/">Merge Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/advanced-activations/">Advanced Activations Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/normalization/">Normalization Layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/noise/">Noise layers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/wrappers/">Layer wrappers</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../layers/writing-your-own-keras-layers/">Writing your own Keras layers</a>
</li>
</ul>
<p class="caption"><span class="caption-text">Preprocessing</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../preprocessing/sequence/">Sequence Preprocessing</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../preprocessing/text/">Text Preprocessing</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../preprocessing/image/">Image Preprocessing</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../losses/">Losses</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../metrics/">Metrics</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../optimizers/">Optimizers</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../activations/">Activations</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../callbacks/">Callbacks</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../datasets/">Datasets</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../applications/">Applications</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../backend/">Backend</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../initializers/">Initializers</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../regularizers/">Regularizers</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../constraints/">Constraints</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../visualization/">Visualization</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../scikit-learn-api/">Scikit-learn API</a>
</li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../utils/">Utils</a>
</li>
</ul>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal current" href="./">Contributing</a>
<ul class="current">
<li class="toctree-l2"><a class="reference internal" href="#bug-reporting">Bug reporting</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#requesting-a-feature">Requesting a Feature</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#requests-for-contributions">Requests for Contributions</a>
</li>
<li class="toctree-l2"><a class="reference internal" href="#pull-requests">Pull Requests</a>
<ul>
<li class="toctree-l3"><a class="reference internal" href="#note">Note:</a>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#adding-new-examples">Adding new examples</a>
</li>
</ul>
</li>
</ul>
<p class="caption"><span class="caption-text">Examples</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../examples/addition_rnn/">Addition RNN</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/antirectifier/">Custom layer - antirectifier</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/babi_rnn/">Baby RNN</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/babi_memnn/">Baby MemNN</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/cifar10_cnn/">CIFAR-10 CNN</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/cifar10_resnet/">CIFAR-10 ResNet</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/conv_filter_visualization/">Convolution filter visualization</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/conv_lstm/">Convolutional LSTM</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/deep_dream/">Deep Dream</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/image_ocr/">Image OCR</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/imdb_bidirectional_lstm/">Bidirectional LSTM</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/imdb_cnn/">1D CNN for text classification</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/imdb_cnn_lstm/">Sentiment classification CNN-LSTM</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/imdb_fasttext/">Fasttext for text classification</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/imdb_lstm/">Sentiment classification LSTM</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/lstm_seq2seq/">Sequence to sequence - training</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/lstm_seq2seq_restore/">Sequence to sequence - prediction</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/lstm_stateful/">Stateful LSTM</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/lstm_text_generation/">LSTM for text generation</a>
</li>
<li class="toctree-l1"><a class="reference internal" href="../examples/mnist_acgan/">Auxiliary Classifier GAN</a>
</li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="..">Keras Documentation</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="..">Docs</a> »</li>
<li>Contributing</li>
<li class="wy-breadcrumbs-aside">
<a href="https://github.com/keras-team/keras/tree/master/docs"
class="icon icon-github"> Edit on GitHub</a>
</li>
</ul>
<hr/>
</div>
<div role="main">
<div class="section">
<h1 id="on-github-issues-and-pull-requests">On Github Issues and Pull Requests</h1>
<p>Found a bug? Have a new feature to suggest? Want to contribute changes to the codebase? Make sure to read this first.</p>
<h2 id="bug-reporting">Bug reporting</h2>
<p>Your code doesn't work, and you have determined that the issue lies with Keras? Follow these steps to report a bug.</p>
<ol>
<li>
<p>Your bug may already be fixed. Make sure to update to the current Keras master branch, as well as the latest Theano/TensorFlow/CNTK master branch.
To easily update Theano: <code>pip install git+git://github.com/Theano/Theano.git --upgrade</code></p>
</li>
<li>
<p>Search for similar issues. Make sure to delete <code>is:open</code> on the issue search to find solved tickets as well. It's possible somebody has encountered this bug already. Also remember to check out Keras' <a href="http://keras.io/faq/">FAQ</a>. Still having a problem? Open an issue on Github to let us know.</p>
</li>
<li>
<p>Make sure you provide us with useful information about your configuration: what OS are you using? What Keras backend are you using? Are you running on GPU? If so, what is your version of Cuda, of cuDNN? What is your GPU?</p>
</li>
<li>
<p>Provide us with a script to reproduce the issue. This script should be runnable as-is and should not require external data download (use randomly generated data if you need to run a model on some test data). We recommend that you use Github Gists to post your code. Any issue that cannot be reproduced is likely to be closed.</p>
</li>
<li>
<p>If possible, take a stab at fixing the bug yourself --if you can!</p>
</li>
</ol>
<p>The more information you provide, the easier it is for us to validate that there is a bug and the faster we'll be able to take action. If you want your issue to be resolved quickly, following the steps above is crucial.</p>
<hr />
<h2 id="requesting-a-feature">Requesting a Feature</h2>
<p>You can also use <a href="https://github.com/tensorflow/tensorflow/issues">Tensorflow Github issues</a> to request features you would like to see in Keras, or changes in the Keras API.</p>
<ol>
<li>
<p>Provide a clear and detailed explanation of the feature you want and why it's important to add. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on library for Keras. It is crucial for Keras to avoid bloating the API and codebase.</p>
</li>
<li>
<p>Provide code snippets demonstrating the API you have in mind and illustrating the use cases of your feature. Of course, you don't need to write any real code at this point!</p>
</li>
<li>
<p>After discussing the feature you may choose to attempt a Pull Request on tf.keras. If you're at all able, start writing some code. We always have more work to do than time to do it. If you can write some code then that will speed the process along.</p>
</li>
</ol>
<hr />
<h2 id="requests-for-contributions">Requests for Contributions</h2>
<p><a href="https://github.com/keras-team/keras/projects/1">This is the board</a> where we list current outstanding issues and features to be added. If you want to start contributing to Keras, this is the place to start.</p>
<hr />
<h2 id="pull-requests">Pull Requests</h2>
<p><strong>Where should I submit my pull request?</strong></p>
<h4 id="note">Note:</h4>
<p>We are no longer adding new features to multi-backend Keras (we only fix bugs), as we are refocusing development efforts on tf.keras. If you are still interested in submitting a feature pull request, please direct it to tf.keras in the TensorFlow repository instead.</p>
<ol>
<li><strong>Keras improvements and bugfixes</strong> go to the <a href="https://github.com/keras-team/keras/tree/master">Keras <code>master</code> branch</a>.</li>
<li><strong>Experimental new features</strong> such as layers and datasets go to <a href="https://github.com/farizrahman4u/keras-contrib">keras-contrib</a>. Unless it is a new feature listed in <a href="https://github.com/keras-team/keras/projects/1">Requests for Contributions</a>, in which case it belongs in core Keras. If you think your feature belongs in core Keras, you can submit a design doc to explain your feature and argue for it (see explanations below).</li>
</ol>
<p>Please note that PRs that are primarily about <strong>code style</strong> (as opposed to fixing bugs, improving docs, or adding new functionality) will likely be rejected.</p>
<p>Here's a quick guide to submitting your improvements:</p>
<ol>
<li>
<p>If your PR introduces a change in functionality, make sure you start by writing a design doc and sending it to the Keras mailing list to discuss whether the change should be made, and how to handle it. This will save you from having your PR closed down the road! Of course, if your PR is a simple bug fix, you don't need to do that. The process for writing and submitting design docs is as follow:</p>
<ul>
<li>Start from <a href="https://docs.google.com/document/d/1ZXNfce77LDW9tFAj6U5ctaJmI5mT7CQXOFMEAZo-mAA/edit#">this Google Doc template</a>, and copy it to new Google doc.</li>
<li>Fill in the content. Note that you will need to insert code examples. To insert code, use a Google Doc extension such as <a href="https://chrome.google.com/webstore/detail/code-pretty/igjbncgfgnfpbnifnnlcmjfbnidkndnh?hl=en">CodePretty</a> (there are several such extensions available).</li>
<li>Set sharing settings to "everyone with the link is allowed to comment"</li>
<li>Send the document to <code>keras-users@googlegroups.com</code> with a subject that starts with <code>[API DESIGN REVIEW]</code> (all caps) so that we notice it.</li>
<li>Wait for comments, and answer them as they come. Edit the proposal as necessary.</li>
<li>The proposal will finally be approved or rejected. Once approved, you can send out Pull Requests or ask others to write Pull Requests.</li>
</ul>
</li>
<li>
<p>Write the code (or get others to write it). This is the hard part!</p>
</li>
<li>
<p>Make sure any new function or class you introduce has proper docstrings. Make sure any code you touch still has up-to-date docstrings and documentation. <strong>Docstring style should be respected.</strong> In particular, they should be formatted in MarkDown, and there should be sections for <code>Arguments</code>, <code>Returns</code>, <code>Raises</code> (if applicable). Look at other docstrings in the codebase for examples.</p>
</li>
<li>
<p>Write tests. Your code should have full unit test coverage. If you want to see your PR merged promptly, this is crucial.</p>
</li>
<li>
<p>Run our test suite locally. It's easy: from the Keras folder, simply run: <code>py.test tests/</code>.</p>
<ul>
<li>You will need to install the test requirements as well: <code>pip install -e .[tests]</code>.</li>
</ul>
</li>
<li>
<p>Make sure all tests are passing:</p>
<ul>
<li>with the Theano backend, on Python 2.7 and Python 3.6. Make sure you have the development version of Theano.</li>
<li>with the TensorFlow backend, on Python 2.7 and Python 3.6. Make sure you have the development version of TensorFlow.</li>
<li>with the CNTK backend, on Python 2.7 and Python 3.6. Make sure you have the development version of CNTK.</li>
</ul>
</li>
<li>
<p>We use PEP8 syntax conventions, but we aren't dogmatic when it comes to line length. Make sure your lines stay reasonably sized, though. To make your life easier, we recommend running a PEP8 linter:</p>
<ul>
<li>Install PEP8 packages: <code>pip install pep8 pytest-pep8 autopep8</code></li>
<li>Run a standalone PEP8 check: <code>py.test --pep8 -m pep8</code></li>
<li>You can automatically fix some PEP8 error by running: <code>autopep8 -i --select <errors> <FILENAME></code> for example: <code>autopep8 -i --select E128 tests/keras/backend/test_backends.py</code></li>
</ul>
</li>
<li>
<p>When committing, use appropriate, descriptive commit messages.</p>
</li>
<li>
<p>Update the documentation. If introducing new functionality, make sure you include code snippets demonstrating the usage of your new feature.</p>
</li>
<li>
<p>Submit your PR. If your changes have been approved in a previous discussion, and if you have complete (and passing) unit tests as well as proper docstrings/documentation, your PR is likely to be merged promptly.</p>
</li>
</ol>
<hr />
<h2 id="adding-new-examples">Adding new examples</h2>
<p>Even if you don't contribute to the Keras source code, if you have an application of Keras that is concise and powerful, please consider adding it to our collection of examples. <a href="https://github.com/keras-team/keras/tree/master/examples">Existing examples</a> show idiomatic Keras code: make sure to keep your own script in the same spirit.</p>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="../examples/addition_rnn/" class="btn btn-neutral float-right" title="Addition RNN">Next <span class="icon icon-circle-arrow-right"></span></a>
<a href="../utils/" class="btn btn-neutral" title="Utils"><span class="icon icon-circle-arrow-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<!-- Copyright etc -->
</div>
Built with <a href="https://www.mkdocs.org/">MkDocs</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<div class="rst-versions" role="note" aria-label="versions">
<span class="rst-current-version" data-toggle="rst-current-version">
<a href="http://github.com/keras-team/keras/" class="fa fa-github" style="float: left; color: #fcfcfc"> GitHub</a>
<span><a href="../utils/" style="color: #fcfcfc;">« Previous</a></span>
<span style="margin-left: 15px"><a href="../examples/addition_rnn/" style="color: #fcfcfc">Next »</a></span>
</span>
</div>
<script>var base_url = '..';</script>
<script src="../js/theme.js" defer></script>
<script src="../search/main.js" defer></script>
<script type="text/javascript" defer>
window.onload = function () {
SphinxRtdTheme.Navigation.enable(true);
};
</script>
</body>
</html>
|