Skip to content

Commit

Permalink
debuging tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Kopcinski authored and Mateusz Kopcinski committed Aug 20, 2024
1 parent fdb204a commit 2727f35
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/ex_vision/style_transfer/style_transfer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,23 @@ for {module, opts} <- TestConfiguration.configuration() do
use ExVision.Model.Case, module: unquote(opts[:module])

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test inference for batch (ExVision.StyleTransfer.MosaicFastTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test inference for batch (ExVision.StyleTransfer.CandyTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test inference (ExVision.StyleTransfer.MosaicFastTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test inference (ExVision.StyleTransfer.CandyTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test stateful/process workflow inference for batch (ExVision.StyleTransfer.MosaicFastTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test inference for batch (ExVision.StyleTransfer.MosaicTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test stateful/process workflow inference (ExVision.StyleTransfer.MosaicFastTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test inference (ExVision.StyleTransfer.MosaicTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test stateful/process workflow inference for batch (ExVision.StyleTransfer.CandyTest)

Check failure on line 43 in test/ex_vision/style_transfer/style_transfer_test.exs

View workflow job for this annotation

GitHub Actions / Build and test

test inference for batch (ExVision.StyleTransfer.UdnieFastTest)
use ExVision.TestUtils

require Logger

@impl true
def test_inference_result(result) do
expected_result =
"test/assets/results/style_transfer/#{unquote(opts[:gt_file])}"
|> File.read!()
|> Nx.deserialize()

diff_sum =
expected_result
|> Nx.subtract(result)
|> Nx.reduce(0, fn x, y -> Nx.add(x, y) end)
|> Nx.to_number()

assert diff_sum == 1

assert_tensors_equal(result, expected_result)
end
end
Expand Down
1 change: 1 addition & 0 deletions test/support/exvision/test_utils.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule ExVision.TestUtils do
require Nx
@moduledoc false

import ExUnit.Assertions, only: :macros
Expand Down

0 comments on commit 2727f35

Please sign in to comment.