File size: 25,806 Bytes
e89a301 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 | [
{
"function_name": "FlattenHead.__init__",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "super().__init__",
"functionality": "Initializes the parent class (torch.nn.Module).",
"input": "()",
"output": "None",
"location_or_namespace": "Python built-in"
},
{
"function_call_name": "torch.nn.Flatten",
"functionality": "Flattens a contiguous range of dims into a tensor.",
"input": "start_dim=-2",
"output": "Flatten layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "torch.nn.Linear",
"functionality": "Applies a linear transformation to the incoming data.",
"input": "nf, target_window",
"output": "Linear layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "torch.nn.Dropout",
"functionality": "During training, randomly zeroes some of the elements of the input tensor with probability p.",
"input": "head_dropout",
"output": "Dropout layer object",
"location_or_namespace": "torch.nn"
}
]
},
{
"function_name": "FlattenHead.forward",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "self.flatten",
"functionality": "Flattens the input tensor starting from a specified dimension.",
"input": "x (tensor)",
"output": "Flattened tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.Flatten instance)"
},
{
"function_call_name": "self.linear",
"functionality": "Applies a linear transformation to the input tensor.",
"input": "x (tensor)",
"output": "Transformed tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.Linear instance)"
},
{
"function_call_name": "self.dropout",
"functionality": "Applies dropout to the input tensor.",
"input": "x (tensor)",
"output": "Tensor with dropout applied",
"location_or_namespace": "self_defined_module.py (torch.nn.Dropout instance)"
}
]
},
{
"function_name": "EnEmbedding.__init__",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "super().__init__",
"functionality": "Initializes the parent class (torch.nn.Module).",
"input": "()",
"output": "None",
"location_or_namespace": "Python built-in"
},
{
"function_call_name": "torch.nn.Linear",
"functionality": "Applies a linear transformation to the incoming data.",
"input": "patch_len, d_model, bias=False",
"output": "Linear layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "torch.randn",
"functionality": "Returns a tensor filled with random numbers from a normal distribution with mean 0 and variance 1.",
"input": "1, n_vars, 1, d_model",
"output": "Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.nn.Parameter",
"functionality": "A kind of Tensor that is to be considered a module parameter.",
"input": "tensor (from torch.randn)",
"output": "Parameter object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "PositionalEmbedding",
"functionality": "Generates positional encodings for input sequences.",
"input": "d_model",
"output": "PositionalEmbedding layer object",
"location_or_namespace": "layers.Embed"
},
{
"function_call_name": "torch.nn.Dropout",
"functionality": "During training, randomly zeroes some of the elements of the input tensor with probability p.",
"input": "dropout",
"output": "Dropout layer object",
"location_or_namespace": "torch.nn"
}
]
},
{
"function_name": "EnEmbedding.forward",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "tensor.repeat",
"functionality": "Repeats this tensor along the specified dimensions.",
"input": "(x.shape[0], 1, 1, 1) (dimensions for repetition)",
"output": "Repeated tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "tensor.unfold",
"functionality": "Returns a view of the original tensor which contains all slices of size from self tensor in the dimension.",
"input": "dimension=-1, size=self.patch_len, step=self.patch_len",
"output": "Unfolded tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.reshape",
"functionality": "Returns a tensor with the same data and number of elements as input, but with the specified shape.",
"input": "input_tensor, shape_tuple",
"output": "Reshaped tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.value_embedding",
"functionality": "Applies a linear transformation for value embedding.",
"input": "x (tensor of patches)",
"output": "Embedded tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.Linear instance)"
},
{
"function_call_name": "self.position_embedding",
"functionality": "Adds positional encoding to the input tensor.",
"input": "x (tensor of patches)",
"output": "Tensor with positional encoding",
"location_or_namespace": "self_defined_module.py (PositionalEmbedding instance)"
},
{
"function_call_name": "torch.cat",
"functionality": "Concatenates the given sequence of seq tensors in the given dimension.",
"input": "[x, glb] (list of tensors), dim=2",
"output": "Concatenated tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.dropout",
"functionality": "Applies dropout to the input tensor.",
"input": "x (tensor)",
"output": "Tensor with dropout applied, n_vars (integer)",
"location_or_namespace": "self_defined_module.py (torch.nn.Dropout instance)"
}
]
},
{
"function_name": "Encoder.__init__",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "super().__init__",
"functionality": "Initializes the parent class (torch.nn.Module).",
"input": "()",
"output": "None",
"location_or_namespace": "Python built-in"
},
{
"function_call_name": "torch.nn.ModuleList",
"functionality": "Holds submodules in a list.",
"input": "layers (list of nn.Module)",
"output": "ModuleList object",
"location_or_namespace": "torch.nn"
}
]
},
{
"function_name": "Encoder.forward",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "layer",
"functionality": "Applies an encoder layer transformation (self-attention, cross-attention, feed-forward).",
"input": "x, cross, x_mask=x_mask, cross_mask=cross_mask, tau=tau, delta=delta",
"output": "Transformed tensor x",
"location_or_namespace": "self_defined_module.py (EncoderLayer instance)"
},
{
"function_call_name": "self.norm",
"functionality": "Applies layer normalization to the input tensor.",
"input": "x (tensor)",
"output": "Normalized tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.LayerNorm instance or None)"
},
{
"function_call_name": "self.projection",
"functionality": "Applies a projection (e.g., linear layer) to the input tensor.",
"input": "x (tensor)",
"output": "Projected tensor",
"location_or_namespace": "self_defined_module.py (nn.Module instance or None)"
}
]
},
{
"function_name": "EncoderLayer.__init__",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "super().__init__",
"functionality": "Initializes the parent class (torch.nn.Module).",
"input": "()",
"output": "None",
"location_or_namespace": "Python built-in"
},
{
"function_call_name": "torch.nn.Conv1d",
"functionality": "Applies a 1D convolution over an input signal composed of several input planes.",
"input": "in_channels, out_channels, kernel_size=1",
"output": "Conv1d layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "torch.nn.LayerNorm",
"functionality": "Applies Layer Normalization over a mini-batch of inputs.",
"input": "d_model",
"output": "LayerNorm layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "torch.nn.Dropout",
"functionality": "During training, randomly zeroes some of the elements of the input tensor with probability p.",
"input": "dropout",
"output": "Dropout layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "torch.nn.functional.relu",
"functionality": "Applies the rectified linear unit function element-wise.",
"input": "input_tensor",
"output": "Output tensor",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "torch.nn.functional.gelu",
"functionality": "Applies the Gaussian Error Linear Units function element-wise.",
"input": "input_tensor",
"output": "Output tensor",
"location_or_namespace": "torch.nn.functional"
}
]
},
{
"function_name": "EncoderLayer.forward",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "self.dropout",
"functionality": "Applies dropout to the input tensor.",
"input": "input_tensor",
"output": "Tensor with dropout applied",
"location_or_namespace": "self_defined_module.py (torch.nn.Dropout instance)"
},
{
"function_call_name": "self.self_attention",
"functionality": "Performs self-attention on the input tensor.",
"input": "query=x, key=x, value=x, attn_mask=x_mask, tau=tau, delta=None",
"output": "Tuple (attention_output, attention_weights)",
"location_or_namespace": "self_defined_module.py (AttentionLayer instance)"
},
{
"function_call_name": "self.norm1",
"functionality": "Applies layer normalization.",
"input": "x (tensor)",
"output": "Normalized tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.LayerNorm instance)"
},
{
"function_call_name": "tensor.unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "dim (integer)",
"output": "Tensor with an added dimension",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.reshape",
"functionality": "Returns a tensor with the same data and number of elements as input, but with the specified shape.",
"input": "input_tensor, shape_tuple",
"output": "Reshaped tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.cross_attention",
"functionality": "Performs cross-attention between two input tensors.",
"input": "query=x_glb, key=cross, value=cross, attn_mask=cross_mask, tau=tau, delta=delta",
"output": "Tuple (attention_output, attention_weights)",
"location_or_namespace": "self_defined_module.py (AttentionLayer instance)"
},
{
"function_call_name": "self.norm2",
"functionality": "Applies layer normalization.",
"input": "x_glb (tensor)",
"output": "Normalized tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.LayerNorm instance)"
},
{
"function_call_name": "torch.cat",
"functionality": "Concatenates the given sequence of seq tensors in the given dimension.",
"input": "list_of_tensors, dim (integer)",
"output": "Concatenated tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.activation",
"functionality": "Applies an activation function (ReLU or GeLU).",
"input": "input_tensor",
"output": "Activated tensor",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "tensor.transpose",
"functionality": "Returns a tensor that is a transposed version of input.",
"input": "dim0, dim1 (integers)",
"output": "Transposed tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "self.conv1",
"functionality": "Applies a 1D convolution.",
"input": "input_tensor",
"output": "Convolved tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.Conv1d instance)"
},
{
"function_call_name": "self.conv2",
"functionality": "Applies a 1D convolution.",
"input": "input_tensor",
"output": "Convolved tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.Conv1d instance)"
},
{
"function_call_name": "self.norm3",
"functionality": "Applies layer normalization.",
"input": "x + y (tensor)",
"output": "Normalized tensor",
"location_or_namespace": "self_defined_module.py (torch.nn.LayerNorm instance)"
}
]
},
{
"function_name": "Model.__init__",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "super().__init__",
"functionality": "Initializes the parent class (torch.nn.Module).",
"input": "()",
"output": "None",
"location_or_namespace": "Python built-in"
},
{
"function_call_name": "int",
"functionality": "Converts a number or string to an integer.",
"input": "value (float from division)",
"output": "Integer",
"location_or_namespace": "Python built-in"
},
{
"function_call_name": "EnEmbedding",
"functionality": "Initializes the endogenous embedding layer.",
"input": "self.n_vars, configs.d_model, self.patch_len, configs.dropout",
"output": "EnEmbedding object",
"location_or_namespace": "self_defined_module.py"
},
{
"function_call_name": "DataEmbedding_inverted",
"functionality": "Embeds input data, potentially with inverted dimensions for channel-first processing or specific variate embedding for exogenous variables.",
"input": "configs.seq_len, configs.d_model, configs.embed, configs.freq, configs.dropout",
"output": "DataEmbedding_inverted object",
"location_or_namespace": "layers.Embed"
},
{
"function_call_name": "Encoder",
"functionality": "Initializes the Transformer encoder.",
"input": "list_of_encoder_layers, norm_layer=torch.nn.LayerNorm(configs.d_model)",
"output": "Encoder object",
"location_or_namespace": "self_defined_module.py"
},
{
"function_call_name": "EncoderLayer",
"functionality": "Initializes an encoder layer.",
"input": "self_attention_layer, cross_attention_layer, configs.d_model, configs.d_ff, dropout=configs.dropout, activation=configs.activation",
"output": "EncoderLayer object",
"location_or_namespace": "self_defined_module.py"
},
{
"function_call_name": "AttentionLayer",
"functionality": "A layer that applies an attention mechanism and projects the output.",
"input": "attention_mechanism (FullAttention instance), configs.d_model, configs.n_heads",
"output": "AttentionLayer object",
"location_or_namespace": "layers.SelfAttention_Family"
},
{
"function_call_name": "FullAttention",
"functionality": "Implements a standard scaled dot-product attention mechanism.",
"input": "False, configs.factor, attention_dropout=configs.dropout, output_attention=False",
"output": "FullAttention object",
"location_or_namespace": "layers.SelfAttention_Family"
},
{
"function_call_name": "torch.nn.LayerNorm",
"functionality": "Applies Layer Normalization over a mini-batch of inputs.",
"input": "configs.d_model",
"output": "LayerNorm layer object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "FlattenHead",
"functionality": "Initializes the prediction head which flattens and projects features.",
"input": "configs.enc_in, self.head_nf, configs.pred_len, head_dropout=configs.dropout",
"output": "FlattenHead object",
"location_or_namespace": "self_defined_module.py"
},
{
"function_call_name": "range",
"functionality": "Generates a sequence of numbers.",
"input": "configs.e_layers",
"output": "Range iterator",
"location_or_namespace": "Python built-in"
}
]
},
{
"function_name": "Model.forecast",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "tensor.mean",
"functionality": "Computes the mean of elements across a dimension.",
"input": "dim=1, keepdim=True",
"output": "Tensor with mean values",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "tensor.detach",
"functionality": "Returns a new Tensor, detached from the current graph.",
"input": "()",
"output": "Detached tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.var",
"functionality": "Calculates the variance of all elements in the input tensor.",
"input": "input_tensor, dim=1, keepdim=True, unbiased=False",
"output": "Tensor with variance values",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.sqrt",
"functionality": "Returns a new tensor with the square-root of the elements of input.",
"input": "input_tensor",
"output": "Tensor with square-root values",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.en_embedding",
"functionality": "Applies endogenous embedding to the input tensor.",
"input": "processed_x_enc (tensor)",
"output": "Tuple (embedded_tensor, n_vars)",
"location_or_namespace": "self_defined_module.py (EnEmbedding instance)"
},
{
"function_call_name": "tensor.unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "dim (integer)",
"output": "Tensor with an added dimension",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "tensor.permute",
"functionality": "Returns a view of the original tensor with its dimensions permuted.",
"input": "dims_tuple (e.g., 0, 2, 1)",
"output": "Permuted tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "self.ex_embedding",
"functionality": "Applies exogenous embedding to the input tensor.",
"input": "processed_x_enc (tensor), x_mark_enc (tensor)",
"output": "Embedded tensor",
"location_or_namespace": "self_defined_module.py (DataEmbedding_inverted instance)"
},
{
"function_call_name": "self.encoder",
"functionality": "Passes data through the Transformer encoder.",
"input": "en_embed (tensor), ex_embed (tensor)",
"output": "Encoded tensor",
"location_or_namespace": "self_defined_module.py (Encoder instance)"
},
{
"function_call_name": "torch.reshape",
"functionality": "Returns a tensor with the same data and number of elements as input, but with the specified shape.",
"input": "input_tensor, shape_tuple",
"output": "Reshaped tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.head",
"functionality": "Applies the prediction head to the encoded features.",
"input": "enc_out (tensor)",
"output": "Forecast tensor (dec_out)",
"location_or_namespace": "self_defined_module.py (FlattenHead instance)"
},
{
"function_call_name": "tensor.repeat",
"functionality": "Repeats this tensor along the specified dimensions.",
"input": "dims_tuple (e.g., 1, self.pred_len, 1)",
"output": "Repeated tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "Model.forecast_multi",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "tensor.mean",
"functionality": "Computes the mean of elements across a dimension.",
"input": "dim=1, keepdim=True",
"output": "Tensor with mean values",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "tensor.detach",
"functionality": "Returns a new Tensor, detached from the current graph.",
"input": "()",
"output": "Detached tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.var",
"functionality": "Calculates the variance of all elements in the input tensor.",
"input": "input_tensor, dim=1, keepdim=True, unbiased=False",
"output": "Tensor with variance values",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.sqrt",
"functionality": "Returns a new tensor with the square-root of the elements of input.",
"input": "input_tensor",
"output": "Tensor with square-root values",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.en_embedding",
"functionality": "Applies endogenous embedding to the input tensor.",
"input": "permuted_x_enc (tensor)",
"output": "Tuple (embedded_tensor, n_vars)",
"location_or_namespace": "self_defined_module.py (EnEmbedding instance)"
},
{
"function_call_name": "tensor.permute",
"functionality": "Returns a view of the original tensor with its dimensions permuted.",
"input": "dims_tuple (e.g., 0, 2, 1)",
"output": "Permuted tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "self.ex_embedding",
"functionality": "Applies exogenous embedding to the input tensor.",
"input": "x_enc (tensor), x_mark_enc (tensor)",
"output": "Embedded tensor",
"location_or_namespace": "self_defined_module.py (DataEmbedding_inverted instance)"
},
{
"function_call_name": "self.encoder",
"functionality": "Passes data through the Transformer encoder.",
"input": "en_embed (tensor), ex_embed (tensor)",
"output": "Encoded tensor",
"location_or_namespace": "self_defined_module.py (Encoder instance)"
},
{
"function_call_name": "torch.reshape",
"functionality": "Returns a tensor with the same data and number of elements as input, but with the specified shape.",
"input": "input_tensor, shape_tuple",
"output": "Reshaped tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.head",
"functionality": "Applies the prediction head to the encoded features.",
"input": "enc_out (tensor)",
"output": "Forecast tensor (dec_out)",
"location_or_namespace": "self_defined_module.py (FlattenHead instance)"
},
{
"function_call_name": "tensor.unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "dim (integer)",
"output": "Tensor with an added dimension",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "tensor.repeat",
"functionality": "Repeats this tensor along the specified dimensions.",
"input": "dims_tuple (e.g., 1, self.pred_len, 1)",
"output": "Repeated tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "Model.forward",
"file_path": "models/TimeXer.py",
"function_calls": [
{
"function_call_name": "self.forecast_multi",
"functionality": "Performs forecasting for multivariate features ('M').",
"input": "x_enc, x_mark_enc, x_dec, x_mark_dec",
"output": "Forecast tensor",
"location_or_namespace": "self_defined_module.py"
},
{
"function_call_name": "self.forecast",
"functionality": "Performs forecasting for single/mixed features (not 'M').",
"input": "x_enc, x_mark_enc, x_dec, x_mark_dec",
"output": "Forecast tensor",
"location_or_namespace": "self_defined_module.py"
}
]
}
] |