-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
803 additions
and
307 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import numpy as np | ||
import pytest | ||
import torch | ||
|
||
from yahpo_train.cont_scalers import * | ||
|
||
|
||
def test_cont_scaler(): | ||
def cont_scaler_helper(x, transformer, eps=1e-5): | ||
cr = transformer(x) | ||
x_tf = cr(x) | ||
x_rec = cr.invert(x_tf) | ||
assert torch.max(torch.abs(x_rec - x)).numpy() < eps | ||
|
||
x = torch.rand(100) | ||
|
||
for transformer in [ | ||
ContTransformerNone, | ||
ContTransformerRange, | ||
ContTransformerNegExp, | ||
ContTransformerLog, | ||
ContTransformerMultScalar, | ||
]: | ||
cont_scaler_helper(x, transformer) | ||
|
||
for transformer in [ | ||
ContTransformerNone, | ||
ContTransformerRange, | ||
ContTransformerNegExp, | ||
ContTransformerMultScalar, | ||
]: | ||
cont_scaler_helper(-x, transformer) | ||
|
||
|
||
if __name__ == "__main__": | ||
test_cont_scaler() |
4 changes: 2 additions & 2 deletions
4
yahpo_train/tests/test_onnx.py → yahpo_train/attic/tests/test_onnx.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import onnxruntime as rt | ||
from onnxruntime.datasets import get_example | ||
|
||
if __name__ == '__main__': | ||
if __name__ == "__main__": | ||
file = "/home/flo/lrz_synchshare/multifidelity_data/lcbench/model.onnx" | ||
rt.InferenceSession(file) | ||
rt.InferenceSession(file) |
Oops, something went wrong.