Can I skip `@boundscheck` within a function

julia> function f(x,y)
               @boundscheck size(x) == size(y) || error("sizes do not match")
               x'y
       end
f (generic function with 1 method)

julia> g(x,y) = @inbounds f(x,y)
g (generic function with 1 method)

julia> f(rand(2,2), rand(2))
ERROR: sizes do not match
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] f(x::Matrix{Float64}, y::Vector{Float64})
   @ Main ./REPL[6]:2
 [3] top-level scope
   @ REPL[8]:1

julia> g(rand(2,2), rand(2))
2-element Vector{Float64}:
 0.5974016405805198
 0.49780565668703575
1 Like