class_docstr: ```
  Main class used to tune and train Keras models
  using a Keras generator (e.g., DirectoryIterator).
  Objects of this class should be instantiated using the
  ktrain.get_learner function, rather than directly.
  
  Main parameters are:
  
  model (Model): A compiled instance of keras.engine.training.Model
  train_data (Iterator): a Iterator instance for training set
  val_data (Iterator):   A Iterator instance for validation set
  ```
class_docstr_tok: ["``","`","Main","class","used","to","tune","and","train","Keras","models","using","a","Keras","generator","(","e.g.",",","DirectoryIterator",")",".","Objects","of","this","class","should","be","instantiated","using","the","ktrain.get_learner","function",",","rather","than","directly",".","Main","parameters","are",":","model","(","Model",")",":","A","compiled","instance","of","keras.engine.training.Model","train_data","(","Iterator",")",":","a","Iterator","instance","for","training","set","val_data","(","Iterator",")",":","A","Iterator","instance","for","validation","set","``","`"]
docstr: ```
  Prints output of layer with index <layer_id> to help debug models.
  Uses first example (example_id=0) from first batch from training set, by default.
  ```
docstr_tok: ["``","`","Prints","output","of","layer","with","index","<","layer_id",">","to","help","debug","models",".","Uses","first","example","(","example_id=0",")","from","first","batch","from","training","set",",","by","default",".","``","`"]
code: def layer_output(
      self, layer_id, example_id=0, batch_id=0, use_val=False
  ):
      """
      ```
      Prints output of layer with index <layer_id> to help debug models.
      Uses first example (example_id=0) from first batch from training set, by default.
      ```
      """
  
      inp = self.model.layers[0].input
      outp = self.model.layers[layer_id].output
      f_out = K.function([inp], [outp])
      if not use_val:
          example = self.train_data[0][batch_id][example_id]
      else:
          example = self.val_data[0][batch_id][example_id]
      layer_out = f_out(
          [
              np.array(
                  [
                      example,
                  ]
              )
          ]
      )[0]
      return layer_out
  
imports: from .None import utils
  from .graph.predictor import LinkPredictor, NodePredictor
  from .graph.preprocessor import LinkPreprocessor, NodePreprocessor
  from .imports import *
  from .lroptimize.lrfinder import *
  from .tabular.predictor import TabularPredictor
  from .tabular.preprocessor import TabularPreprocessor
  from .text.ner.predictor import NERPredictor
  from .text.ner.preprocessor import NERPreprocessor
  from .text.predictor import TextPredictor
  from .text.preprocessor import BERTPreprocessor, TextPreprocessor, TransformersPreprocessor
  from .vision.predictor import ImagePredictor
  from .vision.preprocessor import ImagePreprocessor
label_desc: Use image node_id 3 for calling the GenLearner obj's underlying member method code with example usage: obj.layer_output(layer_id, example_id, batch_id, use_val) and returns: layer_out