repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.ops.titans.naive import chunk_titans_linear_ref from fla.utils import assert_close, device def initialize_chunked_param(B, H, T, BT, dtype=torch.float32): # Calculate number of complete chunks and remaining elements num_complete_chunks = T //...
0.006)
assert_*
numeric_literal
tests/ops/test_titans.py
test_naive_chunk
121
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.gated_oja_rule import chunk_gated_oja_rule, fused_recurrent_gated_oja_rule from fla.utils import assert_close, device, is_intel_alchemist def recurrent_oja_ref( q: torch.Tensor, k: torch.Tensor, ...
0.002)
assert_*
numeric_literal
tests/ops/test_oja.py
test_naive_chunk_oja
186
null
fla-org/flash-linear-attention
import pytest import torch from fla.ops.utils.index import ( prepare_chunk_indices, prepare_chunk_offsets, prepare_position_ids, prepare_sequence_ids, prepare_split_cu_seqlens, prepare_token_indices, ) from fla.utils import device def ref_prepare_sequence_ids(cu_seqlens): seqlens = (cu_seq...
opt.long())
assert_*
func_call
tests/ops/test_index.py
test_edge_cases
171
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.ops.delta_rule import chunk_delta_rule, fused_recurrent_delta_rule from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize( ('B', 'T', 'H', 'D', 'scale', 'use_qk_l2norm_in_kernel', 'dtype'), [ pytest.param...
0.008)
assert_*
numeric_literal
tests/ops/test_delta.py
test_chunk
77
null
fla-org/flash-linear-attention
import pytest import torch from fla.modules.token_shift import token_shift, token_shift_ref from fla.utils import assert_close, device test_b_list = [4] test_t_list = [512, 4100, 8192] test_h_list = [2560, 4096] test_cu_seqlens_list = [ None, [0, 4, 7, 40, 128], [0, 10, 20, 64], [0, 32], [0, 1, 3,...
split_at
assert
variable
tests/modules/test_token_shift.py
_split_for_passing
58
null
fla-org/flash-linear-attention
import os import pytest import torch from fla.models import Mamba2Config, Mamba2ForCausalLM from fla.utils import device @pytest.mark.parametrize( ['L', 'B', 'T', 'H', 'D', 'use_l2warp', 'dtype', 'conv_backend'], [ pytest.param(*test, id="L{}-B{}-T{}-H{}-D{}-use_l2warp{}-{}-conv-{}".format(*test)) ...
(B, T, config.vocab_size)
assert
collection
tests/models/test_modeling_mamba2.py
test_modeling
67
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn as nn import torch.nn.functional as F from fla.modules import FusedCrossEntropyLoss, FusedLinearCrossEntropyLoss from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize("B", [2]) @pytest.mark.parametrize("T", [512, 1024]) @pytest.mark.parametrize...
tri_d)
assert_*
variable
tests/modules/test_cross_entropy.py
test_fused_cross_entropy
39
null
fla-org/flash-linear-attention
import pytest import torch from fla.modules.rotary import RotaryEmbedding, rotary_embedding_ref from fla.utils import assert_close, device @pytest.mark.parametrize("B", [2]) @pytest.mark.parametrize("T", [2048, 4096]) @pytest.mark.parametrize("H", [4]) @pytest.mark.parametrize("G", [1, 4]) @pytest.mark.parametrize("D...
tri_q)
assert_*
variable
tests/modules/test_rotary.py
test_rotary
30
null
fla-org/flash-linear-attention
import pytest import torch from fla.modules.token_shift import token_shift, token_shift_ref from fla.utils import assert_close, device test_b_list = [4] test_t_list = [512, 4100, 8192] test_h_list = [2560, 4096] test_cu_seqlens_list = [ None, [0, 4, 7, 40, 128], [0, 10, 20, 64], [0, 32], [0, 1, 3,...
1e-3)
assert_*
numeric_literal
tests/modules/test_token_shift.py
test_token_shift
48
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.gated_oja_rule import chunk_gated_oja_rule, fused_recurrent_gated_oja_rule from fla.utils import assert_close, device, is_intel_alchemist def recurrent_oja_ref( q: torch.Tensor, k: torch.Tensor, ...
0.02)
assert_*
numeric_literal
tests/ops/test_oja.py
test_chunk
377
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.generalized_delta_rule.dplr import chunk_dplr_delta_rule, fused_recurrent_dplr_delta_rule from fla.utils import assert_close, device, device_platform def recurrent_dplr_delta_rule_ref( q: torch.Tensor, ...
0.002)
assert_*
numeric_literal
tests/ops/test_dplr_delta.py
test_fused_recurrent
250
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.generalized_delta_rule.dplr.fused_recurrent import fused_recurrent_dplr_delta_rule from fla.ops.rwkv7.channel_mixing import channel_mixing_rwkv7, channel_mixing_rwkv7_torch from fla.ops.rwkv7.fused_addcmul import fused_addcmul_rwkv7, to...
0.002)
assert_*
numeric_literal
tests/ops/test_rwkv7.py
test_fused_mul_recurrent_fwd
131
null
fla-org/flash-linear-attention
import pytest import torch from fla.ops.utils.index import ( prepare_chunk_indices, prepare_chunk_offsets, prepare_position_ids, prepare_sequence_ids, prepare_split_cu_seqlens, prepare_token_indices, ) from fla.utils import device def ref_prepare_sequence_ids(cu_seqlens): seqlens = (cu_seq...
opt_offsets.long())
assert_*
func_call
tests/ops/test_index.py
test_chunk_utils_correctness
116
null
fla-org/flash-linear-attention
import os import pytest import torch import triton from fla.ops.nsa.naive import naive_nsa from fla.ops.nsa.parallel import parallel_nsa from fla.ops.utils import prepare_token_indices from fla.utils import assert_close, device @pytest.mark.parametrize( ('H', 'HQ', 'D', 'S', 'block_size', 'cu_seqlens', 'dtype'),...
0.004)
assert_*
numeric_literal
tests/ops/test_nsa.py
test_parallel_varlen
145
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.comba import chunk_comba, fused_recurrent_comba from fla.ops.comba.naive import naive_chunk_comba from fla.ops.comba.utils import chunk_comba_cumsum_scalar_fwd from fla.utils import IS_INTEL_ALCHEMIST, assert_close, device def cumsum_c...
0.02)
assert_*
numeric_literal
tests/ops/test_comba.py
test_chunk
197
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.generalized_delta_rule.iplr.chunk import chunk_iplr_delta_rule from fla.ops.generalized_delta_rule.iplr.fused_recurrent import fused_recurrent_iplr_delta_rule from fla.utils import assert_close, device def chunk_iplr_...
0.003)
assert_*
numeric_literal
tests/ops/test_iplr_delta.py
test_fused_recurrent
173
null
fla-org/flash-linear-attention
import os import numpy as np import pytest import torch from fla.ops.log_linear_attn import chunk_log_linear_attn from fla.ops.log_linear_attn.naive import naive_log_linear_attn from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize( ("B", "T", "H", "D", "dtype"), [ pyte...
0.015)
assert_*
numeric_literal
tests/ops/test_log_linear_attn.py
test_chunk_bwd
94
null
fla-org/flash-linear-attention
import os import pytest import torch from fla.ops.retention import chunk_retention, fused_chunk_retention, fused_recurrent_retention, parallel_retention from fla.utils import assert_close, device @pytest.mark.parametrize( ('H', 'K', 'expand_ratio', 'cu_seqlens', 'dtype'), [ pytest.param(*test, id="H{...
0.004)
assert_*
numeric_literal
tests/ops/test_retention.py
test_chunk_varlen
129
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.gated_delta_product import chunk_gated_delta_product from fla.ops.gated_delta_product.chunk_ref import chunk_gated_delta_product_ref from fla.ops.gated_delta_product.naive import naive_recurrent_gated_delta_product from fla.utils import...
0.008)
assert_*
numeric_literal
tests/ops/test_gated_delta_product.py
test_chunk
93
null
fla-org/flash-linear-attention
import logging import os import pytest import torch import torch.distributed as dist import torch.multiprocessing as mp from fla.modules.convolution import causal_conv1d from fla.ops.cp import build_cp_context from fla.utils import assert_close logging.basicConfig(level=logging.INFO, format='%(message)s') def init_...
y_cp_global)
assert_*
variable
tests/context_parallel/test_cp_conv.py
run_cp_conv_test_worker
201
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.gated_oja_rule import chunk_gated_oja_rule, fused_recurrent_gated_oja_rule from fla.utils import assert_close, device, is_intel_alchemist def recurrent_oja_ref( q: torch.Tensor, k: torch.Tensor, ...
0.005)
assert_*
numeric_literal
tests/ops/test_oja.py
test_chunk_forward
297
null
fla-org/flash-linear-attention
import os import pytest import torch from fla.ops.attn.parallel import parallel_attn from fla.ops.utils import prepare_lens from fla.utils import assert_close, check_shared_mem, device @pytest.mark.parametrize( ('H', 'HQ', 'D', 'cu_seqlens'), [ pytest.param(*test, id="H{}-HQ{}-D{}-cu_seqlens{}".forma...
0.004)
assert_*
numeric_literal
tests/ops/test_attn.py
test_parallel_varlen
122
null
fla-org/flash-linear-attention
import pytest import torch import fla.ops.common.intracard_cp as intracard_cp_mod from fla.ops.common.intracard_cp import _intracard_cache from fla.ops.kda import chunk_kda from fla.utils import device def clear_intracard_cache(): _intracard_cache.clear() yield _intracard_cache.clear() @pytest.mark.skipi...
cu_seqlens
assert
variable
tests/ops/test_intracard_cache.py
test_chunk_kda_intracard_cache_hit_same_cu_seqlens_object
89
null
fla-org/flash-linear-attention
import os import pytest import torch from fla.ops.utils import chunk_global_cumsum, chunk_local_cumsum, mean_pooling from fla.ops.utils.index import prepare_lens from fla.ops.utils.pack import pack_sequence, unpack_sequence from fla.utils import assert_close, device def reversed_cumsum(x, dim=-1): dtype = x.dtyp...
tri_dx.to(ref_dx.dtype))
assert_*
func_call
tests/ops/test_utils.py
test_mean_pooling_varlen
326
null
fla-org/flash-linear-attention
import pytest import torch from fla.ops.utils.index import ( prepare_chunk_indices, prepare_chunk_offsets, prepare_position_ids, prepare_sequence_ids, prepare_split_cu_seqlens, prepare_token_indices, ) from fla.utils import device def ref_prepare_sequence_ids(cu_seqlens): seqlens = (cu_seq...
opt_pos)
assert_*
variable
tests/ops/test_index.py
test_prepare_ids_correctness
93
null
fla-org/flash-linear-attention
import pytest import torch from fla.modules.token_shift import token_shift, token_shift_ref from fla.utils import assert_close, device test_b_list = [4] test_t_list = [512, 4100, 8192] test_h_list = [2560, 4096] test_cu_seqlens_list = [ None, [0, 4, 7, 40, 128], [0, 10, 20, 64], [0, 32], [0, 1, 3,...
1
assert
numeric_literal
tests/modules/test_token_shift.py
_split_for_passing
57
null
fla-org/flash-linear-attention
import pytest import torch from fla.ops.utils.index import ( prepare_chunk_indices, prepare_chunk_offsets, prepare_position_ids, prepare_sequence_ids, prepare_split_cu_seqlens, prepare_token_indices, ) from fla.utils import device def ref_prepare_sequence_ids(cu_seqlens): seqlens = (cu_seq...
opt_stack)
assert_*
variable
tests/ops/test_index.py
test_prepare_ids_correctness
98
null
fla-org/flash-linear-attention
import pytest import torch from fla.models.utils import FLACache from fla.utils import device @pytest.mark.parametrize( ['num_layers', 'batch_size', 'chunk_size', 'num_chunks', 'hidden_size', 'num_heads'], [ pytest.param(*test, id=f"L{test[0]}-B{test[1]}-chunk{test[2]}-n{test[3]}-D{test[4]}-H{test[5]}...
expected_seq_len
assert
variable
tests/models/test_cache.py
test_cache_incremental_update
112
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.comba import chunk_comba, fused_recurrent_comba from fla.ops.comba.naive import naive_chunk_comba from fla.ops.comba.utils import chunk_comba_cumsum_scalar_fwd from fla.utils import IS_INTEL_ALCHEMIST, assert_close, device def cumsum_c...
0.002)
assert_*
numeric_literal
tests/ops/test_comba.py
test_fused_recurrent
110
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.generalized_delta_rule.iplr.chunk import chunk_iplr_delta_rule from fla.ops.generalized_delta_rule.iplr.fused_recurrent import fused_recurrent_iplr_delta_rule from fla.utils import assert_close, device def chunk_iplr_...
0.008)
assert_*
numeric_literal
tests/ops/test_iplr_delta.py
test_chunk
235
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.modules.activations import logsigmoid, sigmoid, swiglu, swiglu_linear, swish from fla.utils import assert_close, device @pytest.mark.parametrize( ('B', 'T', 'D', 'compile'), [ (1, 1, 64, False), (2, 500, 128, False), (...
1e-3)
assert_*
numeric_literal
tests/modules/test_activation.py
test_sigmoid
29
null
fla-org/flash-linear-attention
import os import pytest import torch from transformers.configuration_utils import PretrainedConfig from fla.utils import IS_INTEL_ALCHEMIST, IS_NVIDIA_HOPPER, assert_close, device from .test_modeling_utils import ( GENERATION_UNSUPPORTED, HOPPER_EXCLUSIVE, MODELING_UNSUPPORTED_VARLEN, NOT_READY_FOR_T...
(B, T, config.hidden_size)
assert
collection
tests/models/test_modeling_base.py
run_test_model_forward_backward
50
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.ttt import chunk_ttt_linear, fused_chunk_ttt_linear from fla.ops.ttt.naive import chunk_ttt_linear_ref from fla.utils import assert_close, check_shared_mem, device @pytest.mark.parametrize( ('B', 'T', 'H', 'D', 'scale', 'dtype'), ...
0.03)
assert_*
numeric_literal
tests/ops/test_ttt.py
test_fused_chunk
183
null
fla-org/flash-linear-attention
import logging import os import pytest import torch import torch.distributed as dist import torch.multiprocessing as mp import torch.nn.functional as F from fla.ops.cp import build_cp_context from fla.ops.gated_delta_rule import chunk_gated_delta_rule from fla.utils import assert_close logging.basicConfig(level=logg...
0
assert
numeric_literal
tests/context_parallel/test_cp_gdn.py
run_cp_gdn_test_worker
111
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.gated_delta_product import chunk_gated_delta_product from fla.ops.gated_delta_product.chunk_ref import chunk_gated_delta_product_ref from fla.ops.gated_delta_product.naive import naive_recurrent_gated_delta_product from fla.utils import...
0.007)
assert_*
numeric_literal
tests/ops/test_gated_delta_product.py
test_chunk_varlen
179
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.ops.kda import chunk_kda, fused_recurrent_kda from fla.ops.kda.fused_recurrent import fused_recurrent_kda_fwd from fla.ops.kda.gate import fused_kda_gate, naive_kda_gate, naive_kda_lowerbound_gate from fla.ops.kda.naive import naive_chunk_kda, naive_r...
1
assert
numeric_literal
tests/ops/test_kda.py
test_chunk_return_intermediate_states
746
null
fla-org/flash-linear-attention
import os import numpy as np import pytest import torch from fla.ops.log_linear_attn import chunk_log_linear_attn from fla.ops.log_linear_attn.naive import naive_log_linear_attn from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize( ("B", "T", "H", "D", "dtype"), [ pyte...
0.004)
assert_*
numeric_literal
tests/ops/test_log_linear_attn.py
test_chunk
46
null
fla-org/flash-linear-attention
import logging import os import pytest import torch import torch.distributed as dist import torch.multiprocessing as mp import torch.nn.functional as F from fla.ops.cp import build_cp_context from fla.ops.kda import chunk_kda from fla.ops.kda.gate import naive_kda_lowerbound_gate from fla.ops.kda.naive import naive_r...
0
assert
numeric_literal
tests/context_parallel/test_cp_kda.py
run_cp_kda_test_worker
169
null
fla-org/flash-linear-attention
import argparse import os import random import sys from functools import partial import torch import torch.distributed as dist import torch.nn.functional as F from einops import rearrange, repeat from fla.models.utils import Cache from fla.modules.convolution import causal_conv1d from fla.ops.gated_delta_rule import ...
'chunk'
assert
string_literal
benchmarks/cp/test_gdn_with_cp.py
gdn_forward
367
null
fla-org/flash-linear-attention
import pytest import torch from fla.ops.deltaformer import deltaformer_attn from fla.ops.deltaformer.naive import naive_deltaformer_attn from fla.utils import IS_INTEL_ALCHEMIST, assert_close, device @pytest.mark.parametrize( ('B', 'T', 'H', 'D', 'dtype'), [ pytest.param(*test, id="B{}-T{}-H{}-D{}-{}"...
0.008)
assert_*
numeric_literal
tests/ops/test_deltaformer.py
test_deltaformer_attn
61
null
fla-org/flash-linear-attention
import pytest import torch from fla.modules.grpo import fused_grpo_loss, grpo_loss_torch from fla.utils import IS_NVIDIA_HOPPER, assert_close, device, device_torch_lib @pytest.mark.parametrize("B", [2]) @pytest.mark.parametrize("T", [16, 1024, 4096]) @pytest.mark.parametrize("V", [32000, 65536]) @pytest.mark.parametr...
2e-3
assert
numeric_literal
tests/modules/test_grpo.py
test_fused_grpos
52
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.simple_gla.chunk import chunk_simple_gla from fla.ops.simple_gla.fused_chunk import fused_chunk_simple_gla from fla.ops.simple_gla.fused_recurrent import fused_recurrent_simple_gla from fla.ops.simple_gla.naive import naive_parallel_sim...
0.004)
assert_*
numeric_literal
tests/ops/test_simple_gla.py
test_chunk
244
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.ops.titans.naive import chunk_titans_linear_ref from fla.utils import assert_close, device def initialize_chunked_param(B, H, T, BT, dtype=torch.float32): # Calculate number of complete chunks and remaining elements num_complete_chunks = T //...
0.005)
assert_*
numeric_literal
tests/ops/test_titans.py
test_naive_chunk
122
null
fla-org/flash-linear-attention
import os import pytest import torch from transformers.configuration_utils import PretrainedConfig from fla.utils import IS_INTEL_ALCHEMIST, IS_NVIDIA_HOPPER, assert_close, device from .test_modeling_utils import ( GENERATION_UNSUPPORTED, HOPPER_EXCLUSIVE, MODELING_UNSUPPORTED_VARLEN, NOT_READY_FOR_T...
(1, B * T, config.hidden_size)
assert
collection
tests/models/test_modeling_base.py
run_test_model_forward_backward
59
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.path_attn import naive_path_attn from fla.ops.path_attn.parallel import parallel_path_attention from fla.utils import IS_INTEL_ALCHEMIST, assert_close, device @pytest.mark.parametrize( ('B', 'T', 'H', 'HQ', 'D', 'use_forget_gate', ...
0.008)
assert_*
numeric_literal
tests/ops/test_path_attn.py
test_parallel
77
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn as nn import torch.nn.functional as F from fla.modules import FusedLinearCrossEntropyLoss from fla.modules.l2warp import l2_warp as standalone_l2_warp from fla.utils import IS_INTEL_ALCHEMIST, assert_close, device @pytest.mark.parametrize("dtype", [torch.float32, torch.bfloa...
ratio)
assert_*
variable
tests/modules/test_l2warp.py
test_fused_linear_cross_entropy_l2_warp
68
null
fla-org/flash-linear-attention
import logging import os import pytest import torch import torch.distributed as dist import torch.multiprocessing as mp from fla.modules.convolution import causal_conv1d from fla.ops.cp import build_cp_context from fla.utils import assert_close logging.basicConfig(level=logging.INFO, format='%(message)s') def init_...
0
assert
numeric_literal
tests/context_parallel/test_cp_conv.py
run_cp_conv_test_worker
99
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.ttt import chunk_ttt_linear, fused_chunk_ttt_linear from fla.ops.ttt.naive import chunk_ttt_linear_ref from fla.utils import assert_close, check_shared_mem, device @pytest.mark.parametrize( ('B', 'T', 'H', 'D', 'scale', 'dtype'), ...
0.010)
assert_*
numeric_literal
tests/ops/test_ttt.py
test_chunk
91
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.generalized_delta_rule.iplr.chunk import chunk_iplr_delta_rule from fla.ops.generalized_delta_rule.iplr.fused_recurrent import fused_recurrent_iplr_delta_rule from fla.utils import assert_close, device def chunk_iplr_...
0.007)
assert_*
numeric_literal
tests/ops/test_iplr_delta.py
test_chunk
234
null
fla-org/flash-linear-attention
import argparse import os import random import sys from functools import partial import torch import torch.distributed as dist import torch.nn.functional as F from einops import rearrange, repeat from fla.models.utils import Cache from fla.modules.convolution import causal_conv1d from fla.ops.gated_delta_rule import ...
2
assert
numeric_literal
benchmarks/cp/test_gdn_with_cp.py
gdn_forward
357
null
fla-org/flash-linear-attention
import pytest import torch from fla.models.utils import FLACache from fla.utils import device def test_cache_get_seq_length_nonexistent_layer(): """ Test that get_seq_length returns 0 for non-existent layers and handles None layer_idx correctly for populated caches. """ cache = FLACache() # S...
0
assert
numeric_literal
tests/models/test_cache.py
test_cache_get_seq_length_nonexistent_layer
124
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.comba import chunk_comba, fused_recurrent_comba from fla.ops.comba.naive import naive_chunk_comba from fla.ops.comba.utils import chunk_comba_cumsum_scalar_fwd from fla.utils import IS_INTEL_ALCHEMIST, assert_close, device def cumsum_c...
0.005)
assert_*
numeric_literal
tests/ops/test_comba.py
test_chunk
191
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn as nn import torch.nn.functional as F from fla.modules import FusedCrossEntropyLoss, FusedLinearCrossEntropyLoss from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize("B", [2]) @pytest.mark.parametrize("T", [512, 1024]) @pytest.mark.parametrize...
tri_dw)
assert_*
variable
tests/modules/test_cross_entropy.py
test_fused_linear_cross_entropy
80
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.rwkv6 import chunk_rwkv6 from fla.ops.rwkv6.fused_recurrent import fused_recurrent_rwkv6 from fla.utils import assert_close, device, device_platform @pytest.mark.skipif( device_platform == 'intel', reason="Intel Triton Failure"...
0.004)
assert_*
numeric_literal
tests/ops/test_rwkv6.py
test_chunk
98
null
fla-org/flash-linear-attention
import pytest import torch from fla.modules.rotary import RotaryEmbedding, rotary_embedding_ref from fla.utils import assert_close, device @pytest.mark.parametrize("B", [2]) @pytest.mark.parametrize("T", [2048, 4096]) @pytest.mark.parametrize("H", [4]) @pytest.mark.parametrize("G", [1, 4]) @pytest.mark.parametrize("D...
tri_dq)
assert_*
variable
tests/modules/test_rotary.py
test_rotary
32
null
fla-org/flash-linear-attention
import os import pytest import torch from fla.ops.retention import chunk_retention, fused_chunk_retention, fused_recurrent_retention, parallel_retention from fla.utils import assert_close, device @pytest.mark.parametrize( ('B', 'T', 'H', 'K', 'expand_ratio', 'dtype'), [ pytest.param(*test, id="B{}-T{...
0.005)
assert_*
numeric_literal
tests/ops/test_retention.py
test_chunk
56
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.gsa import chunk_gsa, fused_recurrent_gsa from fla.ops.gsa.naive import naive_recurrent_gsa from fla.utils import assert_close, check_shared_mem, device, device_platform @pytest.mark.parametrize( ('B', 'T', 'H', 'D', 'M', 'gate_log...
0.005)
assert_*
numeric_literal
tests/ops/test_gsa.py
test_fused_recurrent
84
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn as nn import torch.nn.functional as F from fla.modules import FusedCrossEntropyLoss, FusedLinearCrossEntropyLoss from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize("B", [2]) @pytest.mark.parametrize("T", [512, 1024]) @pytest.mark.parametrize...
tri_db)
assert_*
variable
tests/modules/test_cross_entropy.py
test_fused_linear_cross_entropy
81
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.ops.gated_delta_product import chunk_gated_delta_product from fla.ops.gated_delta_product.chunk_ref import chunk_gated_delta_product_ref from fla.ops.gated_delta_product.naive import naive_recurrent_gated_delta_product from fla.utils import assert_clo...
0.02)
assert_*
numeric_literal
tests/ops/test_delta_product.py
test_chunk
87
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.generalized_delta_rule.dplr.fused_recurrent import fused_recurrent_dplr_delta_rule from fla.ops.rwkv7.channel_mixing import channel_mixing_rwkv7, channel_mixing_rwkv7_torch from fla.ops.rwkv7.fused_addcmul import fused_addcmul_rwkv7, to...
k.grad)
assert_*
complex_expr
tests/ops/test_rwkv7.py
test_fused_k_update
258
null
fla-org/flash-linear-attention
parser.add_argument("--bench", action="store_true") parser.add_argument("--profile", action="store_true") parser.add_argument("--profile-path", type=str, default="") parser.add_argument("--seqlen", type=int, default=1024*32) parser.add_argument("--mean", type=int, default=1024*32) parser.add_arg...
name2
assert
variable
benchmarks/cp/test_gdn_with_cp.py
test_layer
867
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.generalized_delta_rule.dplr.fused_recurrent import fused_recurrent_dplr_delta_rule from fla.ops.rwkv7.channel_mixing import channel_mixing_rwkv7, channel_mixing_rwkv7_torch from fla.ops.rwkv7.fused_addcmul import fused_addcmul_rwkv7, to...
xk1)
assert_*
variable
tests/ops/test_rwkv7.py
test_fused_rwkv7_addcmul
176
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.ops.delta_rule import chunk_delta_rule, fused_recurrent_delta_rule from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize( ('H', 'D', 'cu_seqlens', 'dtype'), [ pytest.param(*test, id="H{}-D{}-cu_seqlens{}...
0.005)
assert_*
numeric_literal
tests/ops/test_delta.py
test_chunk_varlen
146
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.gated_oja_rule import chunk_gated_oja_rule, fused_recurrent_gated_oja_rule from fla.utils import assert_close, device, is_intel_alchemist def recurrent_oja_ref( q: torch.Tensor, k: torch.Tensor, ...
0.007)
assert_*
numeric_literal
tests/ops/test_oja.py
test_chunk_varlen
462
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import repeat from fla.ops.gated_delta_rule import chunk_gated_delta_rule, fused_recurrent_gated_delta_rule from fla.ops.gated_delta_rule.naive import naive_recurrent_gated_delta_rule from fla.utils import IS_INTEL_ALCHEMIST, assert_clos...
0.005)
assert_*
numeric_literal
tests/ops/test_gated_delta.py
test_chunk
149
null
fla-org/flash-linear-attention
import pytest import torch from fla.ops.utils.index import ( prepare_chunk_indices, prepare_chunk_offsets, prepare_position_ids, prepare_sequence_ids, prepare_split_cu_seqlens, prepare_token_indices, ) from fla.utils import device def ref_prepare_sequence_ids(cu_seqlens): seqlens = (cu_seq...
opt_indices.long())
assert_*
func_call
tests/ops/test_index.py
test_chunk_utils_correctness
126
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import repeat from fla.ops.gated_delta_rule import chunk_gated_delta_rule, fused_recurrent_gated_delta_rule from fla.ops.gated_delta_rule.naive import naive_recurrent_gated_delta_rule from fla.utils import IS_INTEL_ALCHEMIST, assert_clos...
0.008)
assert_*
numeric_literal
tests/ops/test_gated_delta.py
test_chunk
151
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.ops.gated_delta_product import chunk_gated_delta_product from fla.ops.gated_delta_product.chunk_ref import chunk_gated_delta_product_ref from fla.ops.gated_delta_product.naive import naive_recurrent_gated_delta_product from fla.utils import assert_clo...
0.007)
assert_*
numeric_literal
tests/ops/test_delta_product.py
test_chunk_varlen
157
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.generalized_delta_rule.dplr.fused_recurrent import fused_recurrent_dplr_delta_rule from fla.ops.rwkv7.channel_mixing import channel_mixing_rwkv7, channel_mixing_rwkv7_torch from fla.ops.rwkv7.fused_addcmul import fused_addcmul_rwkv7, to...
x2.grad)
assert_*
complex_expr
tests/ops/test_rwkv7.py
test_channel_mixing_gradients
68
null
fla-org/flash-linear-attention
import pytest import torch from fla.models.utils import FLACache from fla.utils import device def test_cache_window_size_does_not_undercount(): """ Test that window_size truncation doesn't undercount sequence length. When window_size is applied and input exceeds it, the full input size should still be...
seq_len
assert
variable
tests/models/test_cache.py
test_cache_window_size_does_not_undercount
159
null
fla-org/flash-linear-attention
import os import pytest import torch import triton from fla.ops.nsa.naive import naive_nsa from fla.ops.nsa.parallel import parallel_nsa from fla.ops.utils import prepare_token_indices from fla.utils import assert_close, device @pytest.mark.parametrize( ('B', 'T', 'H', 'HQ', 'D', 'S', 'block_size', 'scale', 'dty...
0.005)
assert_*
numeric_literal
tests/ops/test_nsa.py
test_parallel
67
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import rearrange from fla.ops.generalized_delta_rule.dplr import chunk_dplr_delta_rule, fused_recurrent_dplr_delta_rule from fla.utils import assert_close, device, device_platform def recurrent_dplr_delta_rule_ref( q: torch.Tensor, ...
0.007)
assert_*
numeric_literal
tests/ops/test_dplr_delta.py
test_chunk
350
null
fla-org/flash-linear-attention
import pytest import torch import torch.nn.functional as F from fla.modules.l2norm import l2_norm from fla.utils import assert_close, device @pytest.mark.parametrize( ('B', 'T', 'H', 'D', 'dtype'), [ pytest.param(*test, id="B{}-T{}-H{}-D{}-{}".format(*test)) for test in [ (1, 63, 1...
0.005)
assert_*
numeric_literal
tests/modules/test_l2norm.py
test_l2norm
36
null
fla-org/flash-linear-attention
import os import numpy as np import pytest import torch from fla.ops.log_linear_attn import chunk_log_linear_attn from fla.ops.log_linear_attn.naive import naive_log_linear_attn from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize( ("B", "T", "H", "D", "dtype"), [ pyte...
0.007)
assert_*
numeric_literal
tests/ops/test_log_linear_attn.py
test_chunk_bwd
91
null
fla-org/flash-linear-attention
import pytest import torch from fla.ops.forgetting_attn import naive_forgetting_attn from fla.ops.forgetting_attn.parallel import parallel_forgetting_attn from fla.utils import IS_INTEL_ALCHEMIST, assert_close, check_shared_mem, device @pytest.mark.parametrize( ('B', 'T', 'H', 'HQ', 'D', 'scale'), [ p...
0.005)
assert_*
numeric_literal
tests/ops/test_forgetting_attn.py
test_parallel
59
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.common.chunk_scaled_dot_kkt import chunk_scaled_dot_kkt_fwd from fla.ops.utils.solve_tril import solve_tril from fla.utils import assert_close, device, device_platform @pytest.mark.parametrize( ('B', 'T', 'H', 'chunk_size'), [ ...
0.0001)
assert_*
numeric_literal
tests/ops/test_solve_tril.py
test_solve_tril
44
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from fla.ops.generalized_delta_rule.dplr.fused_recurrent import fused_recurrent_dplr_delta_rule from fla.ops.rwkv7.channel_mixing import channel_mixing_rwkv7, channel_mixing_rwkv7_torch from fla.ops.rwkv7.fused_addcmul import fused_addcmul_rwkv7, to...
xa1)
assert_*
variable
tests/ops/test_rwkv7.py
test_fused_rwkv7_addcmul
178
null
fla-org/flash-linear-attention
import os import pytest import torch import torch.nn.functional as F from einops import repeat from fla.ops.gated_delta_rule import chunk_gated_delta_rule, fused_recurrent_gated_delta_rule from fla.ops.gated_delta_rule.naive import naive_recurrent_gated_delta_rule from fla.utils import IS_INTEL_ALCHEMIST, assert_clos...
0.02)
assert_*
numeric_literal
tests/ops/test_gated_delta.py
test_chunk
154
null
fla-org/flash-linear-attention
import os import pytest import torch from fla.ops.utils import chunk_global_cumsum, chunk_local_cumsum, mean_pooling from fla.ops.utils.index import prepare_lens from fla.ops.utils.pack import pack_sequence, unpack_sequence from fla.utils import assert_close, device def reversed_cumsum(x, dim=-1): dtype = x.dtyp...
tri.to(ref.dtype))
assert_*
func_call
tests/ops/test_utils.py
test_mean_pooling_varlen
325
null
argoverse/av2-api
from contextlib import AbstractContextManager from contextlib import nullcontext as does_not_raise from typing import Final import numpy as np import pytest import av2.datasets.motion_forecasting.eval.metrics as metrics from av2.utils.typing import NDArrayFloat test_N: Final[int] = 10 _STATIONARY_GT_TRAJ = np.zeros(...
forecasted_trajectories.shape[:1]
assert
complex_expr
tests/unit/datasets/motion_forecasting/eval/test_metrics.py
test_compute_is_missed_prediction
141
null
argoverse/av2-api
from pathlib import Path import numpy as np import pytest from av2.map.drivable_area import DrivableArea from av2.map.lane_segment import LaneSegment from av2.map.map_api import ArgoverseStaticMap from av2.map.map_primitives import Point, Polyline from av2.map.pedestrian_crossing import PedestrianCrossing from av2.ut...
1
assert
numeric_literal
tests/unit/map/test_map_api.py
test_from_array
TestPolyline
88
null
argoverse/av2-api
from pathlib import Path import numpy as np import av2.utils.io as io_utils from av2.utils.io import read_ego_SE3_sensor, read_feather def test_read_feather(test_data_root_dir: Path) -> None: """Read an Apache Feather file.""" feather_path = ( test_data_root_dir / "sensor_dataset_logs" ...
0
assert
numeric_literal
tests/unit/utils/test_io.py
test_read_feather
25
null
argoverse/av2-api
from pathlib import Path from typing import Any, Callable, Tuple import numpy as np import pytest from scipy.spatial.transform import Rotation import av2.geometry.geometry as geometry_utils from av2.datasets.sensor.constants import AnnotationCategories from av2.geometry.geometry import mat_to_xyz, xyz_to_mat from av2...
rotation_matrix_expected)
assert_*
variable
tests/unit/geometry/test_geometry.py
test_xyz_to_mat_matrix
479
null
argoverse/av2-api
from pathlib import Path from typing import Final, List import numpy as np import pandas as pd import torch from kornia.geometry.conversions import euler_from_quaternion from torch.testing._comparison import assert_close from av2.torch import XYZLWH_QWXYZ_COLUMNS from av2.torch.structures.cuboids import CuboidMode, C...
cuboids_xyzlwh_qwxyz)
assert_*
variable
tests/unit/torch/structures/test_cuboids.py
test_build_cuboids
38
null
argoverse/av2-api
import numpy as np from av2.rendering.color import GRAY_BGR from av2.structures.ndgrid import BEVGrid, NDGrid from av2.utils.typing import NDArrayFloat, NDArrayInt def test_ndgrid_3d() -> None: """Unit tests for the NDGrid class.""" min_range_m = (-5.0, -5.0, -5.0) max_range_m = (+5.0, +5.0, +5.0) res...
dims_expected
assert
variable
tests/unit/structures/test_ndgrid.py
test_ndgrid_3d
21
null
argoverse/av2-api
from typing import Any, Callable import cv2 import numpy as np from cv2.typing import MatLike from av2.rendering.ops.draw import ( alpha_blend_kernel, draw_points_kernel, gaussian_kernel, ) from av2.utils.typing import NDArrayByte, NDArrayInt def _draw_points_cv2( img: MatLike, points_xy: NDArray...
out
assert
variable
tests/unit/rendering/ops/test_draw.py
test_gaussian_kernel
73
null
argoverse/av2-api
import tempfile from pathlib import Path import numpy as np import av2.evaluation.scene_flow.constants as constants import av2.evaluation.scene_flow.eval as eval from av2.evaluation.scene_flow.make_annotation_files import write_annotation from av2.evaluation.scene_flow.utils import write_output_file gts = np.array( ...
0
assert
numeric_literal
tests/unit/evaluation/scene_flow/test_sf_eval.py
test_average_metrics
332
null
argoverse/av2-api
import logging import sys from pathlib import Path from typing import Final, Tuple import click from rich.progress import track import av2.utils.io as io_utils from av2.datasets.sensor.av2_sensor_dataloader import AV2SensorDataLoader from av2.datasets.sensor.constants import RingCameras from av2.datasets.tbv.splits i...
EXPECTED_LANE_SEGMENT_ATTRIB_KEYS
assert
variable
tests/integration/verify_tbv_download.py
verify_log_map
189
null
argoverse/av2-api
import math from pathlib import Path from tempfile import NamedTemporaryFile import numpy as np import pytest import av2.utils.io as io_utils from av2.geometry.sim2 import Sim2 from av2.utils.typing import NDArrayFloat _TEST_DATA_ROOT = Path(__file__).resolve().parent.parent / "test_data" def test_inverse() -> None...
imgSw.inverse()
assert
func_call
tests/unit/utils/test_sim2.py
test_inverse
139
null
argoverse/av2-api
from __future__ import annotations import importlib.util from pathlib import Path from types import ModuleType import pytest def _load_module() -> ModuleType: root = Path(__file__).resolve().parents[2] module_path = root / "scripts" / "validate_tag_version.py" spec = importlib.util.spec_from_file_locatio...
message
assert
variable
tests/unit/test_validate_tag_version.py
test_validate_tag_alignment_mismatch
49
null
argoverse/av2-api
from __future__ import annotations import importlib.util from pathlib import Path from types import ModuleType import pytest def _load_module() -> ModuleType: root = Path(__file__).resolve().parents[2] module_path = root / "scripts" / "validate_tag_version.py" spec = importlib.util.spec_from_file_locatio...
message.lower()
assert
func_call
tests/unit/test_validate_tag_version.py
test_validate_tag_alignment_skips_non_tag
56
null
argoverse/av2-api
import numpy as np import av2.geometry.polyline_utils as polyline_utils from av2.utils.typing import NDArrayFloat def test_straight_centerline_to_polygon() -> None: """Try converting a simple straight polyline into a polygon. Represents the conversion from a centerline to a lane segment polygon. Note th...
(7, 2)
assert
collection
tests/unit/utils/test_polyline_utils.py
test_straight_centerline_to_polygon
69
null
argoverse/av2-api
import math from pathlib import Path from tempfile import NamedTemporaryFile import numpy as np import pytest import av2.utils.io as io_utils from av2.geometry.sim2 import Sim2 from av2.utils.typing import NDArrayFloat _TEST_DATA_ROOT = Path(__file__).resolve().parent.parent / "test_data" def rotmat2d(theta: float)...
0
assert
numeric_literal
tests/unit/utils/test_sim2.py
test_sim2_theta_deg_1
243
null
argoverse/av2-api
from typing import List import numpy as np import av2.geometry.mesh_grid as mesh_grid_utils from av2.utils.typing import NDArrayFloat def test_get_mesh_grid_as_point_cloud_3x3square() -> None: """Ensure a sampled regular grid returns 9 grid points from 1 meter resolution on 2x2 meter area.""" min_x = -3 # i...
(9, 2)
assert
collection
tests/unit/utils/test_mesh_grid.py
test_get_mesh_grid_as_point_cloud_3x3square
25
null
argoverse/av2-api
from pathlib import Path from typing import Final from av2.torch.data_loaders.detection import DetectionDataLoader TEST_DATA_DIR: Final = ( Path(__file__).parent.parent.parent.resolve() / "test_data" / "sensor_dataset_logs" ) def test_build_data_loader() -> None: """Test building the PyTorch Detection DataLo...
None
assert
none_literal
tests/unit/torch/data_loaders/test_detection_dataloader.py
test_build_data_loader
22
null
argoverse/av2-api
import math from pathlib import Path from tempfile import NamedTemporaryFile import numpy as np import pytest import av2.utils.io as io_utils from av2.geometry.sim2 import Sim2 from av2.utils.typing import NDArrayFloat _TEST_DATA_ROOT = Path(__file__).resolve().parent.parent / "test_data" def test_scale() -> None: ...
3.0
assert
numeric_literal
tests/unit/utils/test_sim2.py
test_scale
85
null
argoverse/av2-api
from enum import Enum from typing import Any, Callable, List, Tuple import numpy as np import pytest from av2.datasets.sensor.constants import AnnotationCategories from av2.geometry.se3 import SE3 from av2.structures.cuboid import Cuboid, CuboidList from av2.utils.typing import NDArrayBool, NDArrayFloat def _get_dum...
height_m_expected
assert
variable
tests/unit/structures/test_cuboid.py
test_cuboid_constructor
163
null
argoverse/av2-api
from pathlib import Path from typing import Final import pandas as pd from av2.torch.structures.cuboids import Cuboids from av2.torch.structures.lidar import Lidar from av2.torch.structures.sweep import Sweep from av2.torch.structures.utils import SE3_from_frame TEST_DATA_DIR: Final = Path(__file__).parent.parent.pa...
None
assert
none_literal
tests/unit/torch/structures/test_sweep.py
test_build_sweep
38
null
argoverse/av2-api
import unittest from av2.map.lane_segment import LaneMarkType, LaneSegment, LaneType from av2.map.map_primitives import Point, Polyline class TestLaneSegment(unittest.TestCase): def test_from_dict(self) -> None: """Ensure object is generated correctly from a dictionary.""" json_data = { ...
LaneType("VEHICLE")
assert
func_call
tests/unit/map/test_lane_segment.py
test_from_dict
TestLaneSegment
42
null
argoverse/av2-api
import unittest from av2.map.drivable_area import DrivableArea class TestDrivableArea(unittest.TestCase): def test_from_dict(self) -> None: """Ensure object is generated correctly from a dictionary. Note: 3 arbitrary waypoints taken from the dummy log map file. """ json_data = { ...
4499430
assert
numeric_literal
tests/unit/map/test_drivable_area.py
test_from_dict
TestDrivableArea
30
null