class_docstr: Basic engine class for training and evaluation. It runs a specific process method
  :meth:`step` which is based on the given :attr:`schedule` over each batch of a dataset.
  It controls a iteration in training.
  
  Args:
      model (``torch.nn.Module``): The neural network model.
      optimizer (``colossalai.interface.OptimizerWrapper``): Optimizer for updating the parameters.
      criterion (``torch.nn.modules.loss._Loss``, optional): Loss function for calculating loss.
      gradient_handlers (List[``BaseGradientHandler``], optional): A list of gradient handler used in backward.
      clip_grad_norm (float, optional): The norm of gradient clipping.
      ophook_list (list): List of ophook.
      verbose (bool): whether to display log info.
      schedule (''BaseSchedule''): Runtime schedule.
  
  Examples:
      >>> # define model, criterion, optimizer, lr_scheduler, train_dataloader for your training
      >>> model = ...
      >>> criterion = ...
      >>> optimizer = ...
      >>> train_dataloader = ...
      >>> engine, _, _, _ = colossalai.initialize(model, optimizer, criterion)
      >>> engine.train()
      >>> for inputs, labels in train_dataloader
      >>>     # set gradients to zero
      >>>     engine.zero_grad()
      >>>     # run forward pass
      >>>     outputs = engine(inputs)
      >>>     # compute loss value and run backward pass
      >>>     loss = engine.criterion(outputs, labels)
      >>>     engine.backward(loss)
      >>>     # update parameters
      >>>     engine.step()
  
  The example of using Engine in training could be find in
  `Training with engine and trainer <https://www.colossalai.org/docs/basics/engine_trainer>`_. and
  `Run resnet cifar10 with engine <https://github.com/hpcaitech/ColossalAI-Examples/blob/main/image/resnet/run_resnet_cifar10_with_engine.py>`_.
class_docstr_tok: ["Basic","engine","class","for","training","and","evaluation",".","It","runs","a","specific","process","method",":","meth",":","`","step","`","which","is","based","on","the","given",":","attr",":","`","schedule","`","over","each","batch","of","a","dataset",".","It","controls","a","iteration","in","training",".","Args",":","model","(","``","torch.nn.Module","``",")",":","The","neural","network","model",".","optimizer","(","``","colossalai.interface.OptimizerWrapper","``",")",":","Optimizer","for","updating","the","parameters",".","criterion","(","``","torch.nn.modules.loss._Loss","``",",","optional",")",":","Loss","function","for","calculating","loss",".","gradient_handlers","(","List","[","``","BaseGradientHandler","``","]",",","optional",")",":","A","list","of","gradient","handler","used","in","backward",".","clip_grad_norm","(","float",",","optional",")",":","The","norm","of","gradient","clipping",".","ophook_list","(","list",")",":","List","of","ophook",".","verbose","(","bool",")",":","whether","to","display","log","info",".","schedule","(","``","BaseSchedule","''",")",":","Runtime","schedule",".","Examples",":",">",">",">","#","define","model",",","criterion",",","optimizer",",","lr_scheduler",",","train_dataloader","for","your","training",">",">",">","model","=","...",">",">",">","criterion","=","...",">",">",">","optimizer","=","...",">",">",">","train_dataloader","=","...",">",">",">","engine",",","_",",","_",",","_","=","colossalai.initialize","(","model",",","optimizer",",","criterion",")",">",">",">","engine.train","(",")",">",">",">","for","inputs",",","labels","in","train_dataloader",">",">",">","#","set","gradients","to","zero",">",">",">","engine.zero_grad","(",")",">",">",">","#","run","forward","pass",">",">",">","outputs","=","engine","(","inputs",")",">",">",">","#","compute","loss","value","and","run","backward","pass",">",">",">","loss","=","engine.criterion","(","outputs",",","labels",")",">",">",">","engine.backward","(","loss",")",">",">",">","#","update","parameters",">",">",">","engine.step","(",")","The","example","of","using","Engine","in","training","could","be","find","in","`","Training","with","engine","and","trainer","<","https",":","\/\/www.colossalai.org\/docs\/basics\/engine_trainer",">","`","_",".","and","`","Run","resnet","cifar10","with","engine","<","https",":","\/\/github.com\/hpcaitech\/ColossalAI-Examples\/blob\/main\/image\/resnet\/run_resnet_cifar10_with_engine.py",">","`","_","."]
docstr: Set the gradient of parameters to zero
docstr_tok: ["Set","the","gradient","of","parameters","to","zero"]
code: def zero_grad(self):
      """Set the gradient of parameters to zero"""
      self.optimizer.zero_grad()
  
imports: from typing import Iterable, List, Optional, Type
  from torch import Tensor
  from torch.nn import Module
  from torch.nn.modules.loss import _Loss
  from colossalai.interface import OptimizerWrapper
  from colossalai.legacy.engine.gradient_handler import BaseGradientHandler
  from colossalai.legacy.engine.schedule import BaseSchedule, InterleavedPipelineSchedule, NonPipelineSchedule, PipelineSchedule
  from colossalai.legacy.zero.gemini import BaseOpHook, register_ophooks_recursively
  from colossalai.logging import get_dist_logger
label_desc: Use image node_id 10 for calling the Engine obj's underlying member method code with example usage: obj.zero_grad() without return types