Exemplo n.º 1
0
def test_triplet_distance_setter():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    try:
        new_siamese.distance = "a"
    except:
        new_siamese.distance == "L2"

    assert new_siamese.distance == "squared-L2"
Exemplo n.º 2
0
def test_cross_entropy_distance_setter():
    new_base = mlp.Base()
    new_siamese = cross_entropy.CrossEntropySiamese(new_base)

    try:
        new_siamese.distance = "a"
    except:
        new_siamese.distance == "concat"

    assert new_siamese.distance == "concat"
Exemplo n.º 3
0
def test_triplet_loss_type_setter():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    try:
        new_siamese.loss_type = "a"
    except:
        new_siamese.loss_type = "hard"

    assert new_siamese.loss_type == "hard"
Exemplo n.º 4
0
def test_triplet_margin_setter():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    try:
        new_siamese.margin = -1
    except:
        new_siamese.margin = 1.0

    assert new_siamese.margin == 1.0
Exemplo n.º 5
0
def test_triplet_soft_setter():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    try:
        new_siamese.soft = -1
    except:
        new_siamese.soft = False

    assert new_siamese.soft is False
Exemplo n.º 6
0
def test_contrastive_distance_setter():
    new_base = mlp.Base()
    new_siamese = contrastive.ContrastiveSiamese(new_base)

    try:
        new_siamese.distance = "a"
    except:
        new_siamese.distance == "L2"

    assert new_siamese.distance == "L2"
Exemplo n.º 7
0
def test_contrastive_margin_setter():
    new_base = mlp.Base()
    new_siamese = contrastive.ContrastiveSiamese(new_base)

    try:
        new_siamese.margin = -1
    except:
        new_siamese.margin = 1.0

    assert new_siamese.margin == 1.0
Exemplo n.º 8
0
def test_cross_entropy_distance():
    new_base = mlp.Base()
    new_siamese = cross_entropy.CrossEntropySiamese(new_base)

    assert new_siamese.distance == "concat"
Exemplo n.º 9
0
def test_triplet_loss_type():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    assert new_siamese.loss_type == "hard"
Exemplo n.º 10
0
def test_triplet_distance():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    assert new_siamese.distance == "squared-L2"
Exemplo n.º 11
0
def test_triplet_margin():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    assert new_siamese.margin == 1.0
Exemplo n.º 12
0
def test_triplet_soft():
    new_base = mlp.Base()
    new_siamese = triplet.TripletSiamese(new_base)

    assert new_siamese.soft is False
Exemplo n.º 13
0
def test_contrastive_margin():
    new_base = mlp.Base()
    new_siamese = contrastive.ContrastiveSiamese(new_base)

    assert new_siamese.margin == 1.0
Exemplo n.º 14
0
def test_contrastive_distance():
    new_base = mlp.Base()
    new_siamese = contrastive.ContrastiveSiamese(new_base)

    assert new_siamese.distance == "L2"