code: def get_flattened_model_parameters(model):
      """
      Returns a flattened list of all `torch` or `tensorflow` model parameters.
      """
      if isinstance(model, nn.Module):
          return np.concatenate(
              [
                  _PytorchBackend.to_numpy(p).reshape(-1)
                  for p in model.parameters()
              ]
          )
      elif isinstance(model, tf.keras.Model):
          return np.concatenate(
              [
                  _TensorFlowBackend.to_numpy(p).reshape(-1)
                  for p in model.trainable_weights
              ]
          )
  
imports: import pytest
  import random
  import os
  import numpy
  from tensorflow import keras
  import tensorflow
  import torch
  import torch.nn
  from sklearn.datasets import make_classification, make_regression
  from sklearn.model_selection import train_test_split
  from alibi.explainers.similarity.backends.pytorch.base import _PytorchBackend
  from alibi.explainers.similarity.backends.tensorflow.base import _TensorFlowBackend
label_desc: Use image node_id 3 for calling a global function with example usage: get_flattened_model_parameters(model) and returns: np, np