code: def trend_model(
      F,
      num_coefficients: int,
      context_length: int,
      prediction_length: int,
      is_forecast: bool,
  ) -> Tensor:
      """
      Creates a polynomial basis of degree num_coefficients-1.
      """
      t = linear_space(
          F, context_length, prediction_length, fwd_looking=is_forecast
      )
      T = F.stack(*[t**i for i in range(num_coefficients)])
      return T
  
imports: from typing import List, Optional
  import mxnet
  import numpy
  from gluonts.core.component import validated
  from gluonts.mx import Tensor
  from gluonts.mx.block.scaler import MeanScaler, NOPScaler
  from gluonts.time_feature import get_seasonality
label_desc: Use image node_id 3 for calling a global function with example usage: trend_model(F, num_coefficients, context_length, prediction_length, is_forecast) and returns: T