Skip to content

Leaky relu failing tests #176

@AdarshKumar712

Description

@AdarshKumar712

When I am trying to check for gradient float preserving tests seperately, it is failing tests:

julia> using Test

julia> using Zygote

julia> using NNlib

julia> typeof(leakyrelu'(Float32(0.5)))
Float64

julia> function test_gradient_float_precision_preserving(a)
           @testset "$(a): " begin
               for T in [Float32, Float64]
                   for val in [-10, -1, 0, 1, 10]
                       val = @inferred a'(T(val))
                       @test typeof(val) == T
                   end
               end
           end
       end
test_gradient_float_precision_preserving (generic function with 1 method)

julia> test_gradient_float_precision_preserving(leakyrelu)
leakyrelu: : Test Failed at REPL[5]:6
  Expression: typeof(val) == T
   Evaluated: Float64 == Float32
Stacktrace:
 [1] macro expansion at ./REPL[5]:6 [inlined]
 [2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107 [inlined]
 [3] test_gradient_float_precision_preserving(::Function) at ./REPL[5]:3
leakyrelu: : Test Failed at REPL[5]:6
  Expression: typeof(val) == T
   Evaluated: Float64 == Float32
Stacktrace:
 [1] macro expansion at ./REPL[5]:6 [inlined]
 [2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107 [inlined]
 [3] test_gradient_float_precision_preserving(::Function) at ./REPL[5]:3
leakyrelu: : Test Failed at REPL[5]:6
  Expression: typeof(val) == T
   Evaluated: Float64 == Float32
Stacktrace:
 [1] macro expansion at ./REPL[5]:6 [inlined]
 [2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107 [inlined]
 [3] test_gradient_float_precision_preserving(::Function) at ./REPL[5]:3
leakyrelu: : Test Failed at REPL[5]:6
  Expression: typeof(val) == T
   Evaluated: Float64 == Float32
Stacktrace:
 [1] macro expansion at ./REPL[5]:6 [inlined]
 [2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107 [inlined]
 [3] test_gradient_float_precision_preserving(::Function) at ./REPL[5]:3
leakyrelu: : Test Failed at REPL[5]:6
  Expression: typeof(val) == T
   Evaluated: Float64 == Float32
Stacktrace:
 [1] macro expansion at ./REPL[5]:6 [inlined]
 [2] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Test/src/Test.jl:1107 [inlined]
 [3] test_gradient_float_precision_preserving(::Function) at ./REPL[5]:3
Test Summary: | Pass  Fail  Total
leakyrelu:    |    5     5     10
ERROR: Some tests did not pass: 5 passed, 5 failed, 0 errored, 0 broken.

PS. I understood the reason for this. This might be because of version difference between master branch and released version of NNlib

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions