Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returning tensors lists much faster. #993

Merged
merged 1 commit into from
Mar 17, 2023
Merged

Returning tensors lists much faster. #993

merged 1 commit into from
Mar 17, 2023

Conversation

dfalbel
Copy link
Member

@dfalbel dfalbel commented Mar 17, 2023

Fixes #992

> bench::mark(a = {splitted <- torch::torch_split(sortedTensor[,2], counts)})
# A tibble: 1 × 13
  expression      min   median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time result          memory     time           gc      
  <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm> <list>          <list>     <list>         <list>  
1 a             177ms    177ms      5.58    1.15MB        0     3     0      538ms <list [74,999]> <Rprofmem> <bench_tm [3]> <tibble>

compared to

# A tibble: 1 × 13
  expression      min   median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time result          memory     time           gc      
  <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm> <list>          <list>     <list>         <list>  
1 a             1.11m    1.11m    0.0150      21GB     4.12     1   275      1.11m <list [74,999]> <Rprofmem> <bench_tm [1]> <tibble>

@dfalbel dfalbel merged commit 6e721fb into main Mar 17, 2023
@dfalbel dfalbel deleted the faster-tensor-list branch March 17, 2023 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

torch_split much slower than equivalent function in pytorch
1 participant