Skip to content
Snippets Groups Projects
Select Git revision
  • 6070744895d45273e38ed09e0c7f67acc5fe23c7
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2449-GuidPidSlugToProjectSettings
  • Issue/2309-docs
  • Issue/2355-topLevelOrg
  • Issue/2328-noFailOnLog
  • Hotfix/2371-fixGitLabinRCV
  • Issue/2287-guestRole
  • Fix/xxxx-activateGitlab
  • Test/xxxx-enablingGitLab
  • Issue/2349-gitlabHttps
  • Issue/2259-updatePids
  • Issue/2101-gitLabResTypeUi
  • Hotfix/2202-fixNaNQuota
  • Issue/2246-quotaResoval
  • Issue/2221-projectDateCreated
  • Hotfix/2224-quotaSizeAnalytics
  • Fix/xxxx-resourceVisibility
  • Issue/2000-gitlabResourcesAPI
  • v4.4.3
  • v4.4.2
  • v4.4.1
  • v4.4.0
  • v4.3.4
  • v4.3.3
  • v4.3.2
  • v4.3.1
  • v4.3.0
  • v4.2.8
  • v4.2.7
  • v4.2.6
  • v4.2.5
  • v4.2.4
  • v4.2.3
  • v4.2.2
  • v4.2.1
  • v4.2.0
  • v4.1.1
  • v4.1.0
41 results

DatabaseConnection.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    test.py 1.03 KiB
    import torch
    import numpy as np
    from src.data.generators import KSAT_Generator
    from src.csp.csp_data import CSP_Data
    
    # ksat_generator = KSAT_Generator(min_n=3, max_n=3, min_k=2, max_k=2, min_alpha=1.0, max_alpha=1.0)
    #
    # # Create a random Boolean satisfiability instance
    # csp_data_instance = ksat_generator.create_random_instance()
    #
    # logits = torch.ones((csp_data_instance.num_val,), device=csp_data_instance.device, dtype=torch.float32)
    # assignment, _ = csp_data_instance.hard_assign_sample(logits)
    #
    # print("Generated Assignment:", assignment)
    # is_satisfied = csp_data_instance.constraint_is_sat(assignment)
    x = torch.as_tensor([1, 0, 1, 0, 2, 2, 0, 2, 0, 1]).view(2, 5)
    a = x.view(2, 1, -1)
    b = x.view(2, -1, 1)
    print(a)
    c = a == b
    #
    c = c.prod(dim=0)
    rep = torch.tril(c, -1).max(dim=1)[0]
    u = 1 - rep
    rep[rep == 1] = -1
    print(torch.logical_or(u, rep))
    # a = torch.randint(2, size=(2,2,5))
    # print(a)
    # indices = torch.nonzero(a == 1, as_tuple=False)
    
    # Flatten the indices to a 1D tensor
    # flattened_indices = indices.view(-1)
    
    # print(indices)