File: index.html

package info (click to toggle)
keras 2.3.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 9,288 kB
  • sloc: python: 48,266; javascript: 1,794; xml: 297; makefile: 36; sh: 30
file content (1028 lines) | stat: -rw-r--r-- 52,321 bytes parent folder | download
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
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
<!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/models/sequential/">
  <link rel="shortcut icon" href="../../img/favicon.ico">
  <title>Sequential - 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 = "Sequential";
    var mkdocs_page_input_path = "models/sequential.md";
    var mkdocs_page_url = "/models/sequential/";
  </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 class="current">
                    <li class="toctree-l1"><a class="reference internal" href="../about-keras-models/">About Keras models</a>
                    </li>
                    <li class="toctree-l1 current"><a class="reference internal current" href="./">Sequential</a>
    <ul class="current">
    <li class="toctree-l2"><a class="reference internal" href="#sequential-model-methods">Sequential model methods</a>
        <ul>
    <li class="toctree-l3"><a class="reference internal" href="#compile">compile</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#fit">fit</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evaluate">evaluate</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#predict">predict</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#train_on_batch">train_on_batch</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#test_on_batch">test_on_batch</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#predict_on_batch">predict_on_batch</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#fit_generator">fit_generator</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#evaluate_generator">evaluate_generator</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#predict_generator">predict_generator</a>
    </li>
    <li class="toctree-l3"><a class="reference internal" href="#get_layer">get_layer</a>
    </li>
        </ul>
    </li>
    </ul>
                    </li>
                    <li class="toctree-l1"><a class="reference internal" href="../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>
                    <li class="toctree-l1"><a class="reference internal" href="../../contributing/">Contributing</a>
                    </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> &raquo;</li>
    
      
        
          <li>Models &raquo;</li>
        
      
    
    <li>Sequential</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="the-sequential-model-api">The Sequential model API</h1>
<p>To get started, read <a href="/getting-started/sequential-model-guide">this guide to the Keras Sequential model</a>.</p>
<hr />
<h2 id="sequential-model-methods">Sequential model methods</h2>
<h3 id="compile">compile</h3>
<pre><code class="python">compile(optimizer, loss=None, metrics=None, loss_weights=None, sample_weight_mode=None, weighted_metrics=None, target_tensors=None)
</code></pre>

<p>Configures the model for training.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>optimizer</strong>: String (name of optimizer) or optimizer instance.
    See <a href="/optimizers">optimizers</a>.</li>
<li><strong>loss</strong>: String (name of objective function) or objective function or
    <code>Loss</code> instance. See <a href="/losses">losses</a>.
    If the model has multiple outputs, you can use a different loss
    on each output by passing a dictionary or a list of losses.
    The loss value that will be minimized by the model
    will then be the sum of all individual losses.</li>
<li><strong>metrics</strong>: List of metrics to be evaluated by the model
    during training and testing. Typically you will use
    <code>metrics=['accuracy']</code>. To specify different metrics for different
    outputs of a multi-output model, you could also pass a dictionary,
    such as
    <code>metrics={'output_a': 'accuracy', 'output_b': ['accuracy', 'mse']}</code>.
    You can also pass a list (len = len(outputs)) of lists of metrics
    such as <code>metrics=[['accuracy'], ['accuracy', 'mse']]</code> or
    <code>metrics=['accuracy', ['accuracy', 'mse']]</code>.</li>
<li><strong>loss_weights</strong>: Optional list or dictionary specifying scalar
    coefficients (Python floats) to weight the loss contributions
    of different model outputs.
    The loss value that will be minimized by the model
    will then be the <em>weighted sum</em> of all individual losses,
    weighted by the <code>loss_weights</code> coefficients.
    If a list, it is expected to have a 1:1 mapping
    to the model's outputs. If a dict, it is expected to map
    output names (strings) to scalar coefficients.</li>
<li><strong>sample_weight_mode</strong>: If you need to do timestep-wise
    sample weighting (2D weights), set this to <code>"temporal"</code>.
    <code>None</code> defaults to sample-wise weights (1D).
    If the model has multiple outputs, you can use a different
    <code>sample_weight_mode</code> on each output by passing a
    dictionary or a list of modes.</li>
<li><strong>weighted_metrics</strong>: List of metrics to be evaluated and weighted
    by sample_weight or class_weight during training and testing.</li>
<li><strong>target_tensors</strong>: By default, Keras will create placeholders for the
    model's target, which will be fed with the target data during
    training. If instead you would like to use your own
    target tensors (in turn, Keras will not expect external
    Numpy data for these targets at training time), you
    can specify them via the <code>target_tensors</code> argument. It can be
    a single tensor (for a single-output model), a list of tensors,
    or a dict mapping output names to target tensors.</li>
<li><strong>**kwargs</strong>: When using the Theano/CNTK backends, these arguments
    are passed into <code>K.function</code>.
    When using the TensorFlow backend,
    these arguments are passed into <code>tf.Session.run</code>.</li>
</ul>
<p><strong>Raises</strong></p>
<ul>
<li><strong>ValueError</strong>: In case of invalid arguments for
    <code>optimizer</code>, <code>loss</code>, <code>metrics</code> or <code>sample_weight_mode</code>.</li>
</ul>
<hr />
<h3 id="fit">fit</h3>
<pre><code class="python">fit(x=None, y=None, batch_size=None, epochs=1, verbose=1, callbacks=None, validation_split=0.0, validation_data=None, shuffle=True, class_weight=None, sample_weight=None, initial_epoch=0, steps_per_epoch=None, validation_steps=None, validation_freq=1, max_queue_size=10, workers=1, use_multiprocessing=False)
</code></pre>

<p>Trains the model for a fixed number of epochs (iterations on a dataset).</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>x</strong>: Input data. It could be:<ul>
<li>A Numpy array (or array-like), or a list of arrays
  (in case the model has multiple inputs).</li>
<li>A dict mapping input names to the corresponding
  array/tensors, if the model has named inputs.</li>
<li>A generator or <code>keras.utils.Sequence</code> returning
  <code>(inputs, targets)</code> or <code>(inputs, targets, sample weights)</code>.</li>
<li>None (default) if feeding from framework-native
  tensors (e.g. TensorFlow data tensors).</li>
</ul>
</li>
<li><strong>y</strong>: Target data. Like the input data <code>x</code>,
    it could be either Numpy array(s), framework-native tensor(s),
    list of Numpy arrays (if the model has multiple outputs) or
    None (default) if feeding from framework-native tensors
    (e.g. TensorFlow data tensors).
    If output layers in the model are named, you can also pass a
    dictionary mapping output names to Numpy arrays.
    If <code>x</code> is a generator, or <code>keras.utils.Sequence</code> instance,
    <code>y</code> should not be specified (since targets will be obtained
    from <code>x</code>).</li>
<li><strong>batch_size</strong>: Integer or <code>None</code>.
    Number of samples per gradient update.
    If unspecified, <code>batch_size</code> will default to 32.
    Do not specify the <code>batch_size</code> if your data is in the
    form of symbolic tensors, generators, or <code>Sequence</code> instances
    (since they generate batches).</li>
<li><strong>epochs</strong>: Integer. Number of epochs to train the model.
    An epoch is an iteration over the entire <code>x</code> and <code>y</code>
    data provided.
    Note that in conjunction with <code>initial_epoch</code>,
    <code>epochs</code> is to be understood as "final epoch".
    The model is not trained for a number of iterations
    given by <code>epochs</code>, but merely until the epoch
    of index <code>epochs</code> is reached.</li>
<li><strong>verbose</strong>: Integer. 0, 1, or 2. Verbosity mode.
    0 = silent, 1 = progress bar, 2 = one line per epoch.</li>
<li><strong>callbacks</strong>: List of <code>keras.callbacks.Callback</code> instances.
    List of callbacks to apply during training and validation
    (if ).
    See <a href="/callbacks">callbacks</a>.</li>
<li><strong>validation_split</strong>: Float between 0 and 1.
    Fraction of the training data to be used as validation data.
    The model will set apart this fraction of the training data,
    will not train on it, and will evaluate
    the loss and any model metrics
    on this data at the end of each epoch.
    The validation data is selected from the last samples
    in the <code>x</code> and <code>y</code> data provided, before shuffling.
    This argument is not supported when <code>x</code> is a generator or
    <code>Sequence</code> instance.</li>
<li>
<p><strong>validation_data</strong>: Data on which to evaluate
    the loss and any model metrics at the end of each epoch.
    The model will not be trained on this data.
    <code>validation_data</code> will override <code>validation_split</code>.
    <code>validation_data</code> could be:
        - tuple <code>(x_val, y_val)</code> of Numpy arrays or tensors
        - tuple <code>(x_val, y_val, val_sample_weights)</code> of Numpy arrays
        - dataset or a dataset iterator</p>
<p>For the first two cases, <code>batch_size</code> must be provided.
For the last case, <code>validation_steps</code> must be provided.</p>
</li>
<li>
<p><strong>shuffle</strong>: Boolean (whether to shuffle the training data
    before each epoch) or str (for 'batch').
    'batch' is a special option for dealing with the
    limitations of HDF5 data; it shuffles in batch-sized chunks.
    Has no effect when <code>steps_per_epoch</code> is not <code>None</code>.</p>
</li>
<li><strong>class_weight</strong>: Optional dictionary mapping class indices (integers)
    to a weight (float) value, used for weighting the loss function
    (during training only).
    This can be useful to tell the model to
    "pay more attention" to samples from
    an under-represented class.</li>
<li><strong>sample_weight</strong>: Optional Numpy array of weights for
    the training samples, used for weighting the loss function
    (during training only). You can either pass a flat (1D)
    Numpy array with the same length as the input samples
    (1:1 mapping between weights and samples),
    or in the case of temporal data,
    you can pass a 2D array with shape
    <code>(samples, sequence_length)</code>,
    to apply a different weight to every timestep of every sample.
    In this case you should make sure to specify
    <code>sample_weight_mode="temporal"</code> in <code>compile()</code>. This argument
    is not supported when <code>x</code> generator, or <code>Sequence</code> instance,
    instead provide the sample_weights as the third element of <code>x</code>.</li>
<li><strong>initial_epoch</strong>: Integer.
    Epoch at which to start training
    (useful for resuming a previous training run).</li>
<li><strong>steps_per_epoch</strong>: Integer or <code>None</code>.
    Total number of steps (batches of samples)
    before declaring one epoch finished and starting the
    next epoch. When training with input tensors such as
    TensorFlow data tensors, the default <code>None</code> is equal to
    the number of samples in your dataset divided by
    the batch size, or 1 if that cannot be determined.</li>
<li><strong>validation_steps</strong>: Only relevant if <code>steps_per_epoch</code>
    is specified. Total number of steps (batches of samples)
    to validate before stopping.</li>
<li><strong>validation_steps</strong>: Only relevant if <code>validation_data</code> is provided
    and is a generator. Total number of steps (batches of samples)
    to draw before stopping when performing validation at the end
    of every epoch.</li>
<li><strong>validation_freq</strong>: Only relevant if validation data is provided. Integer
    or list/tuple/set. If an integer, specifies how many training
    epochs to run before a new validation run is performed, e.g.
    <code>validation_freq=2</code> runs validation every 2 epochs. If a list,
    tuple, or set, specifies the epochs on which to run validation,
    e.g. <code>validation_freq=[1, 2, 10]</code> runs validation at the end
    of the 1st, 2nd, and 10th epochs.</li>
<li><strong>max_queue_size</strong>: Integer. Used for generator or <code>keras.utils.Sequence</code>
    input only. Maximum size for the generator queue.
    If unspecified, <code>max_queue_size</code> will default to 10.</li>
<li><strong>workers</strong>: Integer. Used for generator or <code>keras.utils.Sequence</code> input
    only. Maximum number of processes to spin up
    when using process-based threading. If unspecified, <code>workers</code>
    will default to 1. If 0, will execute the generator on the main
    thread.</li>
<li><strong>use_multiprocessing</strong>: Boolean. Used for generator or
    <code>keras.utils.Sequence</code> input only. If <code>True</code>, use process-based
    threading. If unspecified, <code>use_multiprocessing</code> will default to
    <code>False</code>. Note that because this implementation relies on
    multiprocessing, you should not pass non-picklable arguments to
    the generator as they can't be passed easily to children processes.</li>
<li><strong>**kwargs</strong>: Used for backwards compatibility.</li>
</ul>
<p><strong>Returns</strong></p>
<p>A <code>History</code> object. Its <code>History.history</code> attribute is
a record of training loss values and metrics values
at successive epochs, as well as validation loss values
and validation metrics values (if applicable).</p>
<p><strong>Raises</strong></p>
<ul>
<li><strong>RuntimeError</strong>: If the model was never compiled.</li>
<li><strong>ValueError</strong>: In case of mismatch between the provided input data
    and what the model expects.</li>
</ul>
<hr />
<h3 id="evaluate">evaluate</h3>
<pre><code class="python">evaluate(x=None, y=None, batch_size=None, verbose=1, sample_weight=None, steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False)
</code></pre>

<p>Returns the loss value &amp; metrics values for the model in test mode.</p>
<p>Computation is done in batches.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>x</strong>: Input data. It could be:<ul>
<li>A Numpy array (or array-like), or a list of arrays
  (in case the model has multiple inputs).</li>
<li>A dict mapping input names to the corresponding
  array/tensors, if the model has named inputs.</li>
<li>A generator or <code>keras.utils.Sequence</code> returning
  <code>(inputs, targets)</code> or <code>(inputs, targets, sample weights)</code>.</li>
<li>None (default) if feeding from framework-native
  tensors (e.g. TensorFlow data tensors).</li>
</ul>
</li>
<li><strong>y</strong>: Target data. Like the input data <code>x</code>,
    it could be either Numpy array(s), framework-native tensor(s),
    list of Numpy arrays (if the model has multiple outputs) or
    None (default) if feeding from framework-native tensors
    (e.g. TensorFlow data tensors).
    If output layers in the model are named, you can also pass a
    dictionary mapping output names to Numpy arrays.
    If <code>x</code> is a generator, or <code>keras.utils.Sequence</code> instance,
    <code>y</code> should not be specified (since targets will be obtained
    from <code>x</code>).</li>
<li><strong>batch_size</strong>: Integer or <code>None</code>.
    Number of samples per gradient update.
    If unspecified, <code>batch_size</code> will default to 32.
    Do not specify the <code>batch_size</code> is your data is in the
    form of symbolic tensors, generators, or
    <code>keras.utils.Sequence</code> instances (since they generate batches).</li>
<li><strong>verbose</strong>: 0 or 1. Verbosity mode.
    0 = silent, 1 = progress bar.</li>
<li><strong>sample_weight</strong>: Optional Numpy array of weights for
    the test samples, used for weighting the loss function.
    You can either pass a flat (1D)
    Numpy array with the same length as the input samples
    (1:1 mapping between weights and samples),
    or in the case of temporal data,
    you can pass a 2D array with shape
    <code>(samples, sequence_length)</code>,
    to apply a different weight to every timestep of every sample.
    In this case you should make sure to specify
    <code>sample_weight_mode="temporal"</code> in <code>compile()</code>.</li>
<li><strong>steps</strong>: Integer or <code>None</code>.
    Total number of steps (batches of samples)
    before declaring the evaluation round finished.
    Ignored with the default value of <code>None</code>.</li>
<li><strong>callbacks</strong>: List of <code>keras.callbacks.Callback</code> instances.
    List of callbacks to apply during evaluation.
    See <a href="/callbacks">callbacks</a>.</li>
<li><strong>max_queue_size</strong>: Integer. Used for generator or <code>keras.utils.Sequence</code>
    input only. Maximum size for the generator queue.
    If unspecified, <code>max_queue_size</code> will default to 10.</li>
<li><strong>workers</strong>: Integer. Used for generator or <code>keras.utils.Sequence</code> input
    only. Maximum number of processes to spin up when using
    process-based threading. If unspecified, <code>workers</code> will default
    to 1. If 0, will execute the generator on the main thread.</li>
<li><strong>use_multiprocessing</strong>: Boolean. Used for generator or
    <code>keras.utils.Sequence</code> input only. If <code>True</code>, use process-based
    threading. If unspecified, <code>use_multiprocessing</code> will default to
    <code>False</code>. Note that because this implementation relies on
    multiprocessing, you should not pass non-picklable arguments to
    the generator as they can't be passed easily to children processes.</li>
</ul>
<p><strong>Raises</strong></p>
<ul>
<li><strong>ValueError</strong>: in case of invalid arguments.</li>
</ul>
<p><strong>Returns</strong></p>
<p>Scalar test loss (if the model has a single output and no metrics)
or list of scalars (if the model has multiple outputs
and/or metrics). The attribute <code>model.metrics_names</code> will give you
the display labels for the scalar outputs.</p>
<hr />
<h3 id="predict">predict</h3>
<pre><code class="python">predict(x, batch_size=None, verbose=0, steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False)
</code></pre>

<p>Generates output predictions for the input samples.</p>
<p>Computation is done in batches.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>x</strong>: Input data. It could be:<ul>
<li>A Numpy array (or array-like), or a list of arrays
  (in case the model has multiple inputs).</li>
<li>A dict mapping input names to the corresponding
  array/tensors, if the model has named inputs.</li>
<li>A generator or <code>keras.utils.Sequence</code> returning
  <code>(inputs, targets)</code> or <code>(inputs, targets, sample weights)</code>.</li>
<li>None (default) if feeding from framework-native
  tensors (e.g. TensorFlow data tensors).</li>
</ul>
</li>
<li><strong>batch_size</strong>: Integer or <code>None</code>.
    Number of samples per gradient update.
    If unspecified, <code>batch_size</code> will default to 32.
    Do not specify the <code>batch_size</code> is your data is in the
    form of symbolic tensors, generators, or
    <code>keras.utils.Sequence</code> instances (since they generate batches).</li>
<li><strong>verbose</strong>: Verbosity mode, 0 or 1.</li>
<li><strong>steps</strong>: Total number of steps (batches of samples)
    before declaring the prediction round finished.
    Ignored with the default value of <code>None</code>.</li>
<li><strong>callbacks</strong>: List of <code>keras.callbacks.Callback</code> instances.
    List of callbacks to apply during prediction.
    See <a href="/callbacks">callbacks</a>.</li>
<li><strong>max_queue_size</strong>: Integer. Used for generator or <code>keras.utils.Sequence</code>
    input only. Maximum size for the generator queue.
    If unspecified, <code>max_queue_size</code> will default to 10.</li>
<li><strong>workers</strong>: Integer. Used for generator or <code>keras.utils.Sequence</code> input
    only. Maximum number of processes to spin up when using
    process-based threading. If unspecified, <code>workers</code> will default
    to 1. If 0, will execute the generator on the main thread.</li>
<li><strong>use_multiprocessing</strong>: Boolean. Used for generator or
    <code>keras.utils.Sequence</code> input only. If <code>True</code>, use process-based
    threading. If unspecified, <code>use_multiprocessing</code> will default to
    <code>False</code>. Note that because this implementation relies on
    multiprocessing, you should not pass non-picklable arguments to
    the generator as they can't be passed easily to children processes.</li>
</ul>
<p><strong>Returns</strong></p>
<p>Numpy array(s) of predictions.</p>
<p><strong>Raises</strong></p>
<ul>
<li><strong>ValueError</strong>: In case of mismatch between the provided
    input data and the model's expectations,
    or in case a stateful model receives a number of samples
    that is not a multiple of the batch size.</li>
</ul>
<hr />
<h3 id="train_on_batch">train_on_batch</h3>
<pre><code class="python">train_on_batch(x, y, sample_weight=None, class_weight=None, reset_metrics=True)
</code></pre>

<p>Runs a single gradient update on a single batch of data.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>x</strong>: Numpy array of training data,
    or list of Numpy arrays if the model has multiple inputs.
    If all inputs in the model are named,
    you can also pass a dictionary
    mapping input names to Numpy arrays.</li>
<li><strong>y</strong>: Numpy array of target data,
    or list of Numpy arrays if the model has multiple outputs.
    If all outputs in the model are named,
    you can also pass a dictionary
    mapping output names to Numpy arrays.</li>
<li><strong>sample_weight</strong>: Optional array of the same length as x, containing
    weights to apply to the model's loss for each sample.
    In the case of temporal data, you can pass a 2D array
    with shape (samples, sequence_length),
    to apply a different weight to every timestep of every sample.
    In this case you should make sure to specify
    sample_weight_mode="temporal" in compile().</li>
<li><strong>class_weight</strong>: Optional dictionary mapping
    class indices (integers) to
    a weight (float) to apply to the model's loss for the samples
    from this class during training.
    This can be useful to tell the model to "pay more attention" to
    samples from an under-represented class.</li>
<li><strong>reset_metrics</strong>: If <code>True</code>, the metrics returned will be only for this
    batch. If <code>False</code>, the metrics will be statefully accumulated across
    batches.</li>
</ul>
<p><strong>Returns</strong></p>
<p>Scalar training loss
(if the model has a single output and no metrics)
or list of scalars (if the model has multiple outputs
and/or metrics). The attribute <code>model.metrics_names</code> will give you
the display labels for the scalar outputs.</p>
<hr />
<h3 id="test_on_batch">test_on_batch</h3>
<pre><code class="python">test_on_batch(x, y, sample_weight=None, reset_metrics=True)
</code></pre>

<p>Test the model on a single batch of samples.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>x</strong>: Numpy array of test data,
    or list of Numpy arrays if the model has multiple inputs.
    If all inputs in the model are named,
    you can also pass a dictionary
    mapping input names to Numpy arrays.</li>
<li><strong>y</strong>: Numpy array of target data,
    or list of Numpy arrays if the model has multiple outputs.
    If all outputs in the model are named,
    you can also pass a dictionary
    mapping output names to Numpy arrays.</li>
<li><strong>sample_weight</strong>: Optional array of the same length as x, containing
    weights to apply to the model's loss for each sample.
    In the case of temporal data, you can pass a 2D array
    with shape (samples, sequence_length),
    to apply a different weight to every timestep of every sample.
    In this case you should make sure to specify
    sample_weight_mode="temporal" in compile().</li>
<li><strong>reset_metrics</strong>: If <code>True</code>, the metrics returned will be only for this
    batch. If <code>False</code>, the metrics will be statefully accumulated across
    batches.</li>
</ul>
<p><strong>Returns</strong></p>
<p>Scalar test loss (if the model has a single output and no metrics)
or list of scalars (if the model has multiple outputs
and/or metrics). The attribute <code>model.metrics_names</code> will give you
the display labels for the scalar outputs.</p>
<hr />
<h3 id="predict_on_batch">predict_on_batch</h3>
<pre><code class="python">predict_on_batch(x)
</code></pre>

<p>Returns predictions for a single batch of samples.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>x</strong>: Input samples, as a Numpy array.</li>
</ul>
<p><strong>Returns</strong></p>
<p>Numpy array(s) of predictions.</p>
<hr />
<h3 id="fit_generator">fit_generator</h3>
<pre><code class="python">fit_generator(generator, steps_per_epoch=None, epochs=1, verbose=1, callbacks=None, validation_data=None, validation_steps=None, validation_freq=1, class_weight=None, max_queue_size=10, workers=1, use_multiprocessing=False, shuffle=True, initial_epoch=0)
</code></pre>

<p>Trains the model on data generated batch-by-batch by a Python generator
(or an instance of <code>Sequence</code>).</p>
<p>The generator is run in parallel to the model, for efficiency.
For instance, this allows you to do real-time data augmentation
on images on CPU in parallel to training your model on GPU.</p>
<p>The use of <code>keras.utils.Sequence</code> guarantees the ordering
and guarantees the single use of every input per epoch when
using <code>use_multiprocessing=True</code>.</p>
<p><strong>Arguments</strong></p>
<ul>
<li>
<p><strong>generator</strong>: A generator or an instance of <code>Sequence</code>
    (<code>keras.utils.Sequence</code>) object in order to avoid
    duplicate data when using multiprocessing.
    The output of the generator must be either</p>
<ul>
<li>a tuple <code>(inputs, targets)</code></li>
<li>a tuple <code>(inputs, targets, sample_weights)</code>.</li>
</ul>
<p>This tuple (a single output of the generator) makes a single
batch. Therefore, all arrays in this tuple must have the same
length (equal to the size of this batch). Different batches may
have different sizes. For example, the last batch of the epoch
is commonly smaller than the others, if the size of the dataset
is not divisible by the batch size.
The generator is expected to loop over its data
indefinitely. An epoch finishes when <code>steps_per_epoch</code>
batches have been seen by the model.</p>
</li>
<li>
<p><strong>steps_per_epoch</strong>: Integer.
    Total number of steps (batches of samples)
    to yield from <code>generator</code> before declaring one epoch
    finished and starting the next epoch. It should typically
    be equal to <code>ceil(num_samples / batch_size)</code>
    Optional for <code>Sequence</code>: if unspecified, will use
    the <code>len(generator)</code> as a number of steps.</p>
</li>
<li><strong>epochs</strong>: Integer. Number of epochs to train the model.
    An epoch is an iteration over the entire data provided,
    as defined by <code>steps_per_epoch</code>.
    Note that in conjunction with <code>initial_epoch</code>,
    <code>epochs</code> is to be understood as "final epoch".
    The model is not trained for a number of iterations
    given by <code>epochs</code>, but merely until the epoch
    of index <code>epochs</code> is reached.</li>
<li><strong>verbose</strong>: Integer. 0, 1, or 2. Verbosity mode.
    0 = silent, 1 = progress bar, 2 = one line per epoch.</li>
<li><strong>callbacks</strong>: List of <code>keras.callbacks.Callback</code> instances.
    List of callbacks to apply during training.
    See <a href="/callbacks">callbacks</a>.</li>
<li>
<p><strong>validation_data</strong>: This can be either</p>
<ul>
<li>a generator or a <code>Sequence</code> object for the validation data</li>
<li>tuple <code>(x_val, y_val)</code></li>
<li>tuple <code>(x_val, y_val, val_sample_weights)</code></li>
</ul>
<p>on which to evaluate
the loss and any model metrics at the end of each epoch.
The model will not be trained on this data.</p>
</li>
<li>
<p><strong>validation_steps</strong>: Only relevant if <code>validation_data</code>
    is a generator. Total number of steps (batches of samples)
    to yield from <code>validation_data</code> generator before stopping
    at the end of every epoch. It should typically
    be equal to the number of samples of your
    validation dataset divided by the batch size.
    Optional for <code>Sequence</code>: if unspecified, will use
    the <code>len(validation_data)</code> as a number of steps.</p>
</li>
<li><strong>validation_freq</strong>: Only relevant if validation data is provided. Integer
    or <code>collections.Container</code> instance (e.g. list, tuple, etc.). If an
    integer, specifies how many training epochs to run before a new
    validation run is performed, e.g. <code>validation_freq=2</code> runs
    validation every 2 epochs. If a Container, specifies the epochs on
    which to run validation, e.g. <code>validation_freq=[1, 2, 10]</code> runs
    validation at the end of the 1st, 2nd, and 10th epochs.</li>
<li><strong>class_weight</strong>: Optional dictionary mapping class indices (integers)
    to a weight (float) value, used for weighting the loss function
    (during training only). This can be useful to tell the model to
    "pay more attention" to samples
    from an under-represented class.</li>
<li><strong>max_queue_size</strong>: Integer. Maximum size for the generator queue.
    If unspecified, <code>max_queue_size</code> will default to 10.</li>
<li><strong>workers</strong>: Integer. Maximum number of processes to spin up
    when using process-based threading.
    If unspecified, <code>workers</code> will default to 1. If 0, will
    execute the generator on the main thread.</li>
<li><strong>use_multiprocessing</strong>: Boolean.
    If <code>True</code>, use process-based threading.
    If unspecified, <code>use_multiprocessing</code> will default to <code>False</code>.
    Note that because this implementation
    relies on multiprocessing,
    you should not pass non-picklable arguments to the generator
    as they can't be passed easily to children processes.</li>
<li><strong>shuffle</strong>: Boolean. Whether to shuffle the order of the batches at
    the beginning of each epoch. Only used with instances
    of <code>Sequence</code> (<code>keras.utils.Sequence</code>).
    Has no effect when <code>steps_per_epoch</code> is not <code>None</code>.</li>
<li><strong>initial_epoch</strong>: Integer.
    Epoch at which to start training
    (useful for resuming a previous training run).</li>
</ul>
<p><strong>Returns</strong></p>
<p>A <code>History</code> object. Its <code>History.history</code> attribute is
a record of training loss values and metrics values
at successive epochs, as well as validation loss values
and validation metrics values (if applicable).</p>
<p><strong>Raises</strong></p>
<ul>
<li><strong>ValueError</strong>: In case the generator yields data in an invalid format.</li>
</ul>
<p><strong>Example</strong></p>
<pre><code class="python">def generate_arrays_from_file(path):
    while True:
        with open(path) as f:
            for line in f:
                # create numpy arrays of input data
                # and labels, from each line in the file
                x1, x2, y = process_line(line)
                yield ({'input_1': x1, 'input_2': x2}, {'output': y})

model.fit_generator(generate_arrays_from_file('/my_file.txt'),
                    steps_per_epoch=10000, epochs=10)
</code></pre>

<hr />
<h3 id="evaluate_generator">evaluate_generator</h3>
<pre><code class="python">evaluate_generator(generator, steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False, verbose=0)
</code></pre>

<p>Evaluates the model on a data generator.</p>
<p>The generator should return the same kind of data
as accepted by <code>test_on_batch</code>.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>generator</strong>: Generator yielding tuples (inputs, targets)
    or (inputs, targets, sample_weights)
    or an instance of Sequence (keras.utils.Sequence)
    object in order to avoid duplicate data
    when using multiprocessing.</li>
<li><strong>steps</strong>: Total number of steps (batches of samples)
    to yield from <code>generator</code> before stopping.
    Optional for <code>Sequence</code>: if unspecified, will use
    the <code>len(generator)</code> as a number of steps.</li>
<li><strong>callbacks</strong>: List of <code>keras.callbacks.Callback</code> instances.
    List of callbacks to apply during training.
    See <a href="/callbacks">callbacks</a>.</li>
<li><strong>max_queue_size</strong>: maximum size for the generator queue</li>
<li><strong>workers</strong>: Integer. Maximum number of processes to spin up
    when using process based threading.
    If unspecified, <code>workers</code> will default to 1. If 0, will
    execute the generator on the main thread.</li>
<li><strong>use_multiprocessing</strong>: if True, use process based threading.
    Note that because
    this implementation relies on multiprocessing,
    you should not pass
    non picklable arguments to the generator
    as they can't be passed
    easily to children processes.</li>
<li><strong>verbose</strong>: verbosity mode, 0 or 1.</li>
</ul>
<p><strong>Returns</strong></p>
<p>Scalar test loss (if the model has a single output and no metrics)
or list of scalars (if the model has multiple outputs
and/or metrics). The attribute <code>model.metrics_names</code> will give you
the display labels for the scalar outputs.</p>
<p><strong>Raises</strong></p>
<ul>
<li><strong>ValueError</strong>: In case the generator yields
    data in an invalid format.</li>
</ul>
<hr />
<h3 id="predict_generator">predict_generator</h3>
<pre><code class="python">predict_generator(generator, steps=None, callbacks=None, max_queue_size=10, workers=1, use_multiprocessing=False, verbose=0)
</code></pre>

<p>Generates predictions for the input samples from a data generator.</p>
<p>The generator should return the same kind of data as accepted by
<code>predict_on_batch</code>.</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>generator</strong>: Generator yielding batches of input samples
    or an instance of Sequence (keras.utils.Sequence)
    object in order to avoid duplicate data
    when using multiprocessing.</li>
<li><strong>steps</strong>: Total number of steps (batches of samples)
    to yield from <code>generator</code> before stopping.
    Optional for <code>Sequence</code>: if unspecified, will use
    the <code>len(generator)</code> as a number of steps.</li>
<li><strong>callbacks</strong>: List of <code>keras.callbacks.Callback</code> instances.
    List of callbacks to apply during training.
    See <a href="/callbacks">callbacks</a>.</li>
<li><strong>max_queue_size</strong>: Maximum size for the generator queue.</li>
<li><strong>workers</strong>: Integer. Maximum number of processes to spin up
    when using process based threading.
    If unspecified, <code>workers</code> will default to 1. If 0, will
    execute the generator on the main thread.</li>
<li><strong>use_multiprocessing</strong>: If <code>True</code>, use process based threading.
    Note that because
    this implementation relies on multiprocessing,
    you should not pass
    non picklable arguments to the generator
    as they can't be passed
    easily to children processes.</li>
<li><strong>verbose</strong>: verbosity mode, 0 or 1.</li>
</ul>
<p><strong>Returns</strong></p>
<p>Numpy array(s) of predictions.</p>
<p><strong>Raises</strong></p>
<ul>
<li><strong>ValueError</strong>: In case the generator yields
    data in an invalid format.</li>
</ul>
<hr />
<h3 id="get_layer">get_layer</h3>
<pre><code class="python">get_layer(name=None, index=None)
</code></pre>

<p>Retrieves a layer based on either its name (unique) or index.</p>
<p>If <code>name</code> and <code>index</code> are both provided, <code>index</code> will take precedence.</p>
<p>Indices are based on order of horizontal graph traversal (bottom-up).</p>
<p><strong>Arguments</strong></p>
<ul>
<li><strong>name</strong>: String, name of layer.</li>
<li><strong>index</strong>: Integer, index of layer.</li>
</ul>
<p><strong>Returns</strong></p>
<p>A layer instance.</p>
<p><strong>Raises</strong></p>
<ul>
<li><strong>ValueError</strong>: In case of invalid layer name or index.</li>
</ul>
              
            </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="../model/" class="btn btn-neutral float-right" title="Model (functional API)">Next <span class="icon icon-circle-arrow-right"></span></a>
      
      
        <a href="../about-keras-models/" class="btn btn-neutral" title="About Keras models"><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="../about-keras-models/" style="color: #fcfcfc;">&laquo; Previous</a></span>
      
      
        <span style="margin-left: 15px"><a href="../model/" style="color: #fcfcfc">Next &raquo;</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>