class_docstr: Naive Regression Trainer
  
  Args:
      solver (:obj:`~nnabla.solver.Solver`): Solver object.
      tinput (:obj:`~nnabla.Variable`): Input variable for input feature in training.
      tlabel (:obj:`~nnabla.Variable`): Label variable for lable in training.
      tpred (:obj:`~nnabla.Variable`): Root variable for prediction in the training graph.
      tdata (:obj:`nnabla.utils.data_iterator.DataIterator`): DataIterator for training.
      vinput (:obj:`~nnabla.Variable`): Input variable for input feature in evaluation.
      vlabel (:obj:`~nnabla.Variable`): Label variable for label in evaluation.
      vpred (:obj:`~nnabla.Variable`): Root variable for prediction in the evaluation graph.
      vdata (:obj:`~nnabla.utils.data_iterator.DataIterator`): DataIterator for evaluation.
      monitor_path (:obj:`str`): Monitor path.
      model_save_path (:obj:`str`): Model save path.
      max_epoch (:obj:`int`): Max epoch to train.
      iter_per_epoch (:obj:`int`, optional): Iterations per one epoch. If not set, this value are determined by `tdata.size // tdata.batch_size`.
      val_iter (:obj:`int`, optional): Iterations for evaluation. If not set, this value are determined by `vdata.size // vdata.batch_size`.
  
  
  Example:
  
      .. code-block:: python
  
          import nnabla as nn
          import nnabla.functions as F
          import nnabla.parametric_functions as PF
          import nnabla.solvers as S
  
          import numpy as np
  
          from nnabla.experimental.trainers import NaiveRegressionTrainer
  
          # Batch, channel, height, width
          b, c, h, w = 32, 1, 128, 128
  
          # Train Input
          tinput = nn.Variable([b, c, h, w])
          tlabel = nn.Variable([b, c, h, w])
  
          # Train Model and Loss
          tpred = <training model>
  
          # Test Input
          vinput = nn.Variable([b, c, h, w])
          vlabel = nn.Variable([b, c, h, w])
  
          # Test Model
          vpred = <evaluation model>
  
          # Solver
          solver = S.Adam()
          solver.set_parameters(nn.get_parameters())
  
          # DataIterator
          tdata = <training_data_iterator>
          vdata = <validation_data_iterator>
  
          # Trainer
          trainer = NaiveRegressionTrainer(solver, 
                                           tinput, tlabel, tpred, tdata, 
                                           vinput, vlabel, vpred, vdata, 
                                           <monitor_path>, 
                                           <model_save_path>, 
                                           max_epoch=<max_epoch>)
          trainer.train()
class_docstr_tok: ["Naive","Regression","Trainer","Args",":","solver","(",":","obj",":","`","~nnabla.solver.Solver","`",")",":","Solver","object",".","tinput","(",":","obj",":","`","~nnabla.Variable","`",")",":","Input","variable","for","input","feature","in","training",".","tlabel","(",":","obj",":","`","~nnabla.Variable","`",")",":","Label","variable","for","lable","in","training",".","tpred","(",":","obj",":","`","~nnabla.Variable","`",")",":","Root","variable","for","prediction","in","the","training","graph",".","tdata","(",":","obj",":","`","nnabla.utils.data_iterator.DataIterator","`",")",":","DataIterator","for","training",".","vinput","(",":","obj",":","`","~nnabla.Variable","`",")",":","Input","variable","for","input","feature","in","evaluation",".","vlabel","(",":","obj",":","`","~nnabla.Variable","`",")",":","Label","variable","for","label","in","evaluation",".","vpred","(",":","obj",":","`","~nnabla.Variable","`",")",":","Root","variable","for","prediction","in","the","evaluation","graph",".","vdata","(",":","obj",":","`","~nnabla.utils.data_iterator.DataIterator","`",")",":","DataIterator","for","evaluation",".","monitor_path","(",":","obj",":","`","str","`",")",":","Monitor","path",".","model_save_path","(",":","obj",":","`","str","`",")",":","Model","save","path",".","max_epoch","(",":","obj",":","`","int","`",")",":","Max","epoch","to","train",".","iter_per_epoch","(",":","obj",":","`","int","`",",","optional",")",":","Iterations","per","one","epoch",".","If","not","set",",","this","value","are","determined","by","`","tdata.size","\/\/","tdata.batch_size","`",".","val_iter","(",":","obj",":","`","int","`",",","optional",")",":","Iterations","for","evaluation",".","If","not","set",",","this","value","are","determined","by","`","vdata.size","\/\/","vdata.batch_size","`",".","Example",":","..","code-block",":",":","python","import","nnabla","as","nn","import","nnabla.functions","as","F","import","nnabla.parametric_functions","as","PF","import","nnabla.solvers","as","S","import","numpy","as","np","from","nnabla.experimental.trainers","import","NaiveRegressionTrainer","#","Batch",",","channel",",","height",",","width","b",",","c",",","h",",","w","=","32",",","1",",","128",",","128","#","Train","Input","tinput","=","nn.Variable","(","[","b",",","c",",","h",",","w","]",")","tlabel","=","nn.Variable","(","[","b",",","c",",","h",",","w","]",")","#","Train","Model","and","Loss","tpred","=","<","training","model",">","#","Test","Input","vinput","=","nn.Variable","(","[","b",",","c",",","h",",","w","]",")","vlabel","=","nn.Variable","(","[","b",",","c",",","h",",","w","]",")","#","Test","Model","vpred","=","<","evaluation","model",">","#","Solver","solver","=","S.Adam","(",")","solver.set_parameters","(","nn.get_parameters","(",")",")","#","DataIterator","tdata","=","<","training_data_iterator",">","vdata","=","<","validation_data_iterator",">","#","Trainer","trainer","=","NaiveRegressionTrainer","(","solver",",","tinput",",","tlabel",",","tpred",",","tdata",",","vinput",",","vlabel",",","vpred",",","vdata",",","<","monitor_path",">",",","<","model_save_path",">",",","max_epoch=","<","max_epoch",">",")","trainer.train","(",")"]
code: def __init__(
      self,
      solver,
      tinput=None,
      tlabel=None,
      tpred=None,
      tdata=None,
      vinput=None,
      vlabel=None,
      vpred=None,
      vdata=None,
      monitor_path=None,
      model_save_path=None,
      max_epoch=1,
      iter_per_epoch=None,
      val_iter=None,
  ):
      # Monitors
      monitor = Monitor(monitor_path)
      monitor_loss = MonitorSeries(
          "Training loss", monitor, interval=10
      )
      monitor_vloss = MonitorSeries("Valid loss", monitor, interval=1)
      monitor_time = MonitorTimeElapsed(
          "Training time", monitor, interval=10
      )
  
      # Loss
      tpred = tpred.apply(persistent=True)
      tloss = F.mean(F.squared_error(tpred, tlabel))
      vpred = vpred.apply(persistent=True)
      vloss = F.mean(F.squared_error(vpred, vlabel))
  
      # Updater
      def tdata_feeder():
          tinput.d, tlabel.d = tdata.next()
  
      def update_callback_on_finish(i):
          monitor_loss.add(i, tloss.d)
          monitor_time.add(i)
  
      updater = Updater(
          solver,
          tloss,
          data_feeder=tdata_feeder,
          forward_callback_on_finish=forward_callback_on_finish,
          update_callback_on_finish=update_callback_on_finish,
      )
  
      # Evaluator
      def vdata_feeder():
          vinput.d, vlabel.d = vdata.next()
  
      def vloss_callback_on_finish(i, v):
          monitor_vloss.add(i, v)
  
      val_iter = (
          val_iter
          if val_iter is not None
          else vdata.size // vdata.batch_size
      )
      evaluator = Evaluator(
          vloss,
          data_feeder=vdata_feeder,
          val_iter=val_iter,
          callback_on_finish=vloss_callback_on_finish,
      )
  
      # Trainer
      iter_per_epoch = (
          iter_per_epoch
          if iter_per_epoch is not None
          else tdata.size // tdata.batch_size
      )
      self.trainer = Trainer(
          updater,
          evaluator,
          model_save_path,
          max_epoch=max_epoch,
          iter_per_epoch=iter_per_epoch,
      )
  
file_path: nnabla/python/src/nnabla/experimental/trainers/trainer.py
imports: import os
  import nnabla
  import nnabla.functions
  from nnabla.experimental.trainers import Evaluator
  from nnabla.experimental.trainers import Updater
  from nnabla.monitor import Monitor, MonitorSeries, MonitorTimeElapsed
  from six.moves import range
label_desc: Use image node_id 1 to create a new NaiveRegressionTrainer object from inherited base classes: object with example: obj = NaiveRegressionTrainer(solver, tinput, tlabel, tpred, tdata, vinput, vlabel, vpred, vdata, monitor_path, model_save_path, max_epoch, iter_per_epoch, val_iter)