docstr: Turns a 1-D array into an array or tensor with len(broadcast_array.shape) dims.
  
  Args:
      values: an array or tensor of values to extract.
      broadcast_array: an array with a larger shape of K dimensions with the batch
          dimension equal to the length of timesteps.
  Returns:
      a tensor of shape [batch_size, 1, ...] where the shape has K dims.
docstr_tok: ["Turns","a","1-D","array","into","an","array","or","tensor","with","len","(","broadcast_array.shape",")","dims",".","Args",":","values",":","an","array","or","tensor","of","values","to","extract",".","broadcast_array",":","an","array","with","a","larger","shape","of","K","dimensions","with","the","batch","dimension","equal","to","the","length","of","timesteps",".","Returns",":","a","tensor","of","shape","[","batch_size",",","1",",","...","]","where","the","shape","has","K","dims","."]
code: def match_shape(
      self,
      values: Union[np.ndarray, paddle.Tensor],
      broadcast_array: Union[np.ndarray, paddle.Tensor],
  ):
      """
      Turns a 1-D array into an array or tensor with len(broadcast_array.shape) dims.
  
      Args:
          values: an array or tensor of values to extract.
          broadcast_array: an array with a larger shape of K dimensions with the batch
              dimension equal to the length of timesteps.
      Returns:
          a tensor of shape [batch_size, 1, ...] where the shape has K dims.
      """
  
      tensor_format = getattr(self, "tensor_format", "pd")
      values = values.flatten()
  
      while len(values.shape) < len(broadcast_array.shape):
          values = values[..., None]
  
      return values
  
file_path: PaddleHub/modules/image/text_to_image/stable_diffusion/diffusers/schedulers/scheduling_utils.py
imports: from typing import Union
  import numpy
  import paddle
label_desc: Use image node_id 4 for calling the SchedulerMixin obj's underlying member method code with example usage: obj.match_shape(values, broadcast_array) and returns: values