code: def chebyshev_series(func, width, terms):
      r"""Computes Chebyshev coefficients
  
      For n = terms, the ith Chebyshev series coefficient is
  
      .. math::
          c_i = 2/n \sum_{k=1}^n \cos(j(2k-1)\pi / 4n) f(w\cos((2k-1)\pi / 4n))
  
      Args:
          func (function): function to be approximated
          width (int): approximation will support inputs in range [-width, width]
          terms (int): number of Chebyshev terms used in approximation
  
      Returns:
          Chebyshev coefficients with shape equal to num of terms.
      """
      n_range = torch.arange(start=0, end=terms).float()
      x = width * torch.cos((n_range + 0.5) * np.pi / terms)
      y = func(x)
      cos_term = torch.cos(
          torch.ger(n_range, n_range + 0.5) * np.pi / terms
      )
      coeffs = (2 / terms) * torch.sum(y * cos_term, axis=1)
      return coeffs
  
file_path: FATE/python/fate/arch/protocol/mpc/common/util.py
imports: import functools
  import numpy
  import torch
  from fate.arch.protocol.mpc.cuda import CUDALongTensor
label_desc: Use image node_id 2 for calling a global function with example usage: chebyshev_series(func, width, terms) and returns: coeffs