{"record":{"id":"cc0cdba08c739459","repo":"google-research/timesfm","slug":"activation-config-activation-not-supported-cc0cdb","errorCode":null,"errorMessage":"Activation: {config.activation} not supported.","messagePattern":"Activation: (.+?) not supported\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/timesfm/torch/dense.py","lineNumber":51,"sourceCode":"    )\n    self.output_layer = nn.Linear(\n        in_features=config.hidden_dims,\n        out_features=config.output_dims,\n        bias=config.use_bias,\n    )\n    self.residual_layer = nn.Linear(\n        in_features=config.input_dims,\n        out_features=config.output_dims,\n        bias=config.use_bias,\n    )\n    if config.activation == \"relu\":\n      self.activation = nn.ReLU()\n    elif config.activation == \"swish\":\n      self.activation = nn.SiLU()\n    elif config.activation == \"none\":\n      self.activation = nn.Identity()\n    else:\n      raise ValueError(f\"Activation: {config.activation} not supported.\")\n\n  def forward(self, x: torch.Tensor) -> torch.Tensor:\n    return self.output_layer(\n        self.activation(self.hidden_layer(x))\n    ) + self.residual_layer(x)\n\n\nclass RandomFourierFeatures(nn.Module):\n  \"\"\"Random Fourier features layer.\"\"\"\n\n  def __init__(self, config: configs.RandomFourierFeaturesConfig):\n    super().__init__()\n    self.config = config\n\n    if config.output_dims % 4 != 0:\n      raise ValueError(\n          f\"Output dims must be a multiple of 4: {config.output_dims} % 4 != 0.\"\n      )","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/google-research/timesfm/blob/331c6d33cb1ac2611de3056d0ac7164aab6301eb/src/timesfm/torch/dense.py#L33-L69","documentation":"ResidualBlock builds its activation by exact string match on config.activation, which must be one of 'relu', 'swish', or 'none'. Any other string raises ValueError in __init__, guarding against typos that would otherwise silently pick a wrong activation.","triggerScenarios":"Constructing ResidualBlock (or building the TimesFM 2.5 model from a config) with ResidualBlockConfig(activation=<anything other than \"relu\"|\"swish\"|\"none\">) — e.g. \"gelu\", \"silu\", or \"swish \" with trailing whitespace.","commonSituations":"Porting configs from libraries supporting more activations (gelu, tanh); hand-editing config dataclasses; wrong casing ('Swish','RELU'); building custom model definitions modeled on TimesFM_2p5_200M_Definition.","solutions":["Set activation to one of the supported strings: \"relu\", \"swish\", or \"none\".","If you meant silu/gelu, use \"swish\" (SiLU) — gelu is not supported in this layer.","Check for typos, casing, and stray whitespace in the config string.","To support another activation, add a branch in src/timesfm/torch/dense.py (e.g. nn.GELU()) rather than passing an unsupported string."],"exampleFix":"// before\nconfig = ResidualBlockConfig(input_dims=64, hidden_dims=1280, output_dims=1280, activation=\"gelu\")\n// after\nconfig = ResidualBlockConfig(input_dims=64, hidden_dims=1280, output_dims=1280, activation=\"swish\")","handlingStrategy":"validation","validationCode":"SUPPORTED = {\"relu\", \"swish\", \"none\"}\nassert config.activation in SUPPORTED, f\"activation must be one of {SUPPORTED}\"","typeGuard":null,"tryCatchPattern":"try:\n    block = ResidualBlock(config)\nexcept ValueError as e:\n    if \"Activation\" in str(e):\n        config = dataclasses.replace(config, activation=\"swish\")\n        block = ResidualBlock(config)\n    else:\n        raise","preventionTips":["Use only 'relu', 'swish', or 'none' in ResidualBlockConfig.","Copy activation values from TimesFM_2p5_200M_Definition rather than inventing them.","Watch for casing and whitespace in hand-edited configs.","Validate config dataclasses at construction with an allowlist check."],"tags":["configuration","value-error","neural-network","torch"],"backgroundTag":"unsupported-config-value","analyzedSha":"331c6d33cb1ac2611de3056d0ac7164aab6301eb","analyzedAt":"2026-08-29T01:04:23.138Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}