code: def validate_optimizer(optimizer, test_data, options):
      """
      Set validation and checkpoint for distributed optimizer.
      """
      optimizer.set_validation(
          batch_size=options.batchSize,
          val_rdd=test_data,
          trigger=EveryEpoch(),
          val_method=[Top1Accuracy()],
      )
      optimizer.set_checkpoint(EveryEpoch(), options.checkpointPath)
  
imports: from bigdl.dllib.feature.dataset import mnist
  from bigdl.dllib.feature.dataset.transformer import *
  from bigdl.dllib.optim.optimizer import *
label_desc: Use image node_id 4 for calling a global function with example usage: validate_optimizer(optimizer, test_data, options) without return types