class_docstr: Implementation of Spatio-Temporal Graph Convolutional Networks
docstr: Temporal convolution layer
docstr_tok: ["Temporal","convolution","layer"]
code: def temporal_conv_layer(
      self, x, Kt, c_in, c_out, name, act_func="relu"
  ):
      """Temporal convolution layer"""
      _, T, n, _ = x.shape
      if c_in > c_out:
          x_input = fl.conv2d(
              input=x,
              num_filters=c_out,
              filter_size=[1, 1],
              stride=[1, 1],
              padding="SAME",
              data_format="NHWC",
              param_attr=fluid.ParamAttr(name="%s_conv2d_1" % name),
          )
      elif c_in < c_out:
          # if the size of input channel is less than the output,
          # padding x to the same size of output channel.
          pad = fl.fill_constant_batch_size_like(
              input=x,
              shape=[-1, T, n, c_out - c_in],
              dtype="float32",
              value=0.0,
          )
          x_input = fl.concat([x, pad], axis=3)
      else:
          x_input = x
  
      #  x_input = x_input[:, Kt - 1:T, :, :]
      if act_func == "GLU":
          # gated liner unit
          bt_init = fluid.initializer.ConstantInitializer(value=0.0)
          bt = fl.create_parameter(
              shape=[2 * c_out],
              dtype="float32",
              attr=fluid.ParamAttr(
                  name="%s_bt" % name,
                  trainable=True,
                  initializer=bt_init,
              ),
          )
          x_conv = fl.conv2d(
              input=x,
              num_filters=2 * c_out,
              filter_size=[Kt, 1],
              stride=[1, 1],
              padding="SAME",
              data_format="NHWC",
              param_attr=fluid.ParamAttr(name="%s_conv2d_wt" % name),
          )
          x_conv = x_conv + bt
          return (x_conv[:, :, :, 0:c_out] + x_input) * fl.sigmoid(
              x_conv[:, :, :, -c_out:]
          )
      else:
          bt_init = fluid.initializer.ConstantInitializer(value=0.0)
          bt = fl.create_parameter(
              shape=[c_out],
              dtype="float32",
              attr=fluid.ParamAttr(
                  name="%s_bt" % name,
                  trainable=True,
                  initializer=bt_init,
              ),
          )
          x_conv = fl.conv2d(
              input=x,
              num_filters=c_out,
              filter_size=[Kt, 1],
              stride=[1, 1],
              padding="SAME",
              data_format="NHWC",
              param_attr=fluid.ParamAttr(name="%s_conv2d_wt" % name),
          )
          x_conv = x_conv + bt
          if act_func == "linear":
              return x_conv
          elif act_func == "sigmoid":
              return fl.sigmoid(x_conv)
          elif act_func == "relu":
              return fl.relu(x_conv + x_input)
          else:
              raise ValueError(
                  f'ERROR: activation function "{act_func}" is not defined.'
              )
  
file_path: PGL/legacy/examples/stgcn/models/model.py
imports: import numpy
  import paddle.fluid
  import paddle.fluid.layers
  import pgl
label_desc: Use image node_id 4 for calling the STGCNModel obj's underlying member method code with example usage: obj.temporal_conv_layer(x, Kt, c_in, c_out, name, act_func) and returns: unknown, x_conv, fl, fl