docstr: An abstraction for data owners to share dataset in model training or inference
  
  :param str or Player player: Player or Name of the player
  :param callable generator_builder: Function of building dataset generator
  :param int num_samples: How many samples in this generator
docstr_tok: ["An","abstraction","for","data","owners","to","share","dataset","in","model","training","or","inference",":","param","str","or","Player","player",":","Player","or","Name","of","the","player",":","param","callable","generator_builder",":","Function","of","building","dataset","generator",":","param","int","num_samples",":","How","many","samples","in","this","generator"]
code: def __init__(self, player, generator_builder, num_samples=None):
      """
      An abstraction for data owners to share dataset in model training or inference
  
      :param str or Player player: Player or Name of the player
      :param callable generator_builder: Function of building dataset generator
      :param int num_samples: How many samples in this generator
      """
      if isinstance(player, str):
          self.player = tfe.get_config().get_player(player)
      else:
          self.player = player
      assert isinstance(self.player, tfe.player.Player)
  
      self.num_samples = num_samples
      with tf.device(self.player.device_name):
          self.generator = generator_builder()
          self.first_element = next(self.generator)
  
          if isinstance(self.first_element, (list, tuple)):
              self.first_data_x = self.first_element[0]
              self.first_data_y = self.first_element[1]
          else:
              self.first_data_x = self.first_element
              self.first_data_y = None
  
file_path: tf-encrypted/tf_encrypted/player/data_owner.py
imports: import tensorflow
  import tf_encrypted
label_desc: Use image node_id 1 to create a new DataOwner object  with example: obj = DataOwner(player, generator_builder, num_samples)