code: def train_example(workers_per_node):
      estimator = Estimator.from_torch(
          model=model_creator,
          optimizer=optimizer_creator,
          loss=nn.MSELoss(),
          scheduler_creator=scheduler_creator,
          workers_per_node=workers_per_node,
          config={
              "lr": 1e-2,  # used in optimizer_creator
              "hidden_size": 1,  # used in model_creator
          },
          backend="horovod",
      )
  
      # train 5 epochs
      stats = estimator.fit(train_data_creator, batch_size=4, epochs=5)
      print("train stats: {}".format(stats))
      val_stats = estimator.evaluate(validation_data_creator)
      print("validation stats: {}".format(val_stats))
  
      # retrieve the model
      model = estimator.get_model()
      print(
          "trained weight: % .2f, bias: % .2f"
          % (model.weight.item(), model.bias.item())
      )
  
file_path: BigDL/python/orca/example/learn/horovod/pytorch_estimator.py
imports: import argparse
  import numpy
  import torch
  import torch.nn
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.learn.pytorch import Estimator
label_desc: Use image node_id 6 for calling a global function with example usage: train_example(workers_per_node) without return types