message: Adjust method for embedding lookup
  Summary:
  Adjust the method slightly to avoid select.
  Add the name scope for the proflier.
  Ref T30072
  Test Plan: CI
  Reviewers: jakeh, #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved, jackh
  Maniphest Tasks: T30072
diff: @@ -94,44 +94,52 @@ def embedding_lookup(params,
  if serialization_factor == 1:
  result = gen_popops_ops.ipu_multi_slice(params_2d, ids_flat, name=name)
  else:
  + # Get the scope name so that the function nested operations get the scope
  + # name too.
  + with ops.name_scope(name + "/Serialized") as scope_name:
  @custom_gradient.custom_gradient
  def serialized_embedding_lookup(table, indices):
  +
  + table_shape = table.shape.as_list()
  + assert len(table_shape) == 2
  + assert (table_shape[0] % serialization_factor) == 0
  + split_size = table_shape[0] // serialization_factor
  +
  @functional_ops.outlined_function
  - def func(sliced_table, indices, min_idx, max_idx):
  + def func(sliced_table, indices, min_idx):
  + with ops.name_scope(scope_name):
  # Do a serialized embedding lookup by adjusting the indices.
  adjusted_indices = indices - min_idx
  +
  + # Mask out any indices which are not in range.
  + mask_max = adjusted_indices < split_size
  + mask_min = adjusted_indices > -1
  + mask = math_ops.logical_and(mask_max, mask_min)
  +
  + indices_mask = math_ops.cast(mask, adjusted_indices.dtype)
  + adjusted_indices = adjusted_indices * indices_mask
  +
  x = gen_popops_ops.ipu_multi_slice(sliced_table,
  adjusted_indices,
  name=name)
  - # Mask out any outputs which are not in range [min_idx, max_idx).
  - mask_max = indices < max_idx
  - mask_min = indices >= min_idx
  - mask = math_ops.logical_and(mask_max, mask_min)
  + # Mask out any values which are not in range.
  mask = array_ops.expand_dims(mask, 1)
  - return array_ops.where_v2(mask,
  - x,
  - array_ops.constant(0, x.dtype),
  - name=name + "/Mask")
  -
  - table_shape = table.shape.as_list()
  - assert len(table_shape) == 2
  - assert (table_shape[0] % serialization_factor) == 0
  - split_size = table_shape[0] // serialization_factor
  + mask = math_ops.cast(mask, x.dtype)
  + return x * mask
  # Create the first lookup.
  table_sliced = array_ops.slice(table, [0, 0],
  [split_size, table_shape[1]])
  - output = func(table_sliced, indices, 0, split_size)
  + output = func(table_sliced, indices, 0)
  for i in range(1, serialization_factor):
  min_idx = split_size * i
  - max_idx = split_size * (i + 1)
  table_sliced = array_ops.slice(table, [min_idx, 0],
  [split_size, table_shape[1]])
  - masked_output = func(table_sliced, indices, min_idx, max_idx)
  + masked_output = func(table_sliced, indices, min_idx)
  # Add the masked slice
  output = math_ops.add(output, masked_output, name=f"slice_{i}")
  