code: def test_auto_shard_horovod(self):
      # file 1 contains all 0s, file 2 contains all 1s
      # If shard by files, then each model will
      # see the same records in the same batch.
      # If shard by records, then each batch
      # will have different records.
      # The loss func is constructed such that
      # the former case will return 0, and the latter
      # case will return non-zero.
  
      ray_ctx = OrcaRayContext.get()
      trainer = Estimator.from_keras(
          model_creator=create_auto_shard_model,
          compile_args_creator=create_auto_shard_compile_args,
          verbose=True,
          backend="horovod",
          workers_per_node=2,
      )
      stats = trainer.fit(
          create_auto_shard_datasets,
          epochs=1,
          batch_size=4,
          steps_per_epoch=2,
      )
      assert stats["loss"] == [0.0]
  
imports: import os
  from unittest import TestCase
  import numpy
  import pytest
  import tensorflow
  from bigdl.orca.learn.tf2 import Estimator
  from bigdl.orca.ray import OrcaRayContext
  from bigdl.orca import OrcaContext
label_desc: Use image node_id 2 for calling the TestTFHorovodEstimator obj's underlying member method code with example usage: obj.test_auto_shard_horovod() without return types