Skip to content

Instantly share code, notes, and snippets.

@CarpeNecopinum
Created August 19, 2019 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CarpeNecopinum/126d0ac67b79832a975c74441701d8bb to your computer and use it in GitHub Desktop.
Save CarpeNecopinum/126d0ac67b79832a975c74441701d8bb to your computer and use it in GitHub Desktop.
Comparing split convolutions
using CuArrays
using Flux: Chain, Conv, gpu
batch = rand(256, 256, 1, 16) |> gpu
m1 = Chain(Conv((1,3), 1=>1), Conv((3,1), 1=>1)) |> gpu
m2 = Conv((3,3), 1=>1) |> gpu
using BenchmarkTools: @benchmark
@benchmark m1(batch) # ~ 333.1 us
@benchmark m2(batch) # ~ 271.8 us
using CuArrays
using Flux: Chain, Conv, gpu
batch = rand(256, 256, 1, 16) |> gpu
m1 = Chain(Conv((1,7), 1=>1), Conv((7,1), 1=>1)) |> gpu
m2 = Conv((7,7), 1=>1) |> gpu
using BenchmarkTools: @benchmark
@benchmark m1(batch) # ~ 383.5us
@benchmark m2(batch) # ~ 810.718us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment