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
# Set inpainting model as model A | |
def run_modelmerger(primary_model_name, secondary_model_name, teritary_model_name, interp_method, multiplier, save_as_half, custom_name): | |
def weighted_sum(theta0, theta1, alpha): | |
return ((1 - alpha) * theta0) + (alpha * theta1) | |
def get_difference(theta1, theta2): | |
return theta1 - theta2 | |
def add_difference(theta0, theta1_2_diff, alpha): |
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
public class AzureTableStorage<T> where T : ITableEntity, new() | |
{ | |
private readonly CloudStorageAccount storageAccount; | |
private readonly CloudTableClient tableClient; | |
private readonly CloudTable table; | |
public AzureTableStorage(string connectionString, string tableName) | |
{ | |
// Retrieve the storage account from the connection string. | |
storageAccount = CloudStorageAccount.Parse(connectionString); |
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
public class GameService | |
{ | |
// Lock cannot be used async. Instead we use Semaphores. | |
// We want to avoid race conditions for our game operations. | |
// With this approach we can make sure that only one operation is performed against a specific game at once. | |
//This dictionary contains a semaphore for each game's Id. | |
private readonly Dictionary<Guid, SemaphoreSlim> lockers = new Dictionary<Guid, SemaphoreSlim>(); | |
private SemaphoreSlim GetLocker(Guid id) |