public override object Activate(IEnumerable <KeyValuePair <string, object> > arguments, IServiceProvider services) { if (helper == null) { helper = new ActivationHelper(_method); } var instance = helper.CreateInstance(_method.ReturnType, arguments, services); return(instance); }
public float[,,] FeedForward(float[,,] input) { for (var i = 0; i < this.depth; ++i) { for (var j = 0; j < this.height; ++j) { for (var k = 0; k < this.width; ++k) { this.output[i, j, k] = ActivationHelper.Activation(input[i, j, k]); } } } return(this.output); }
private void UserConfigure(EntityTypeBuilder <UserModel> builder) { builder.HasIndex(u => u.Email).IsUnique(); //email unique constraint builder.HasOne(u => u.Profile).WithOne(p => p.User).HasForeignKey <ProfileModel>(p => p.UserId); //fk UserProfile builder.Property(u => u.Email).IsRequired(); //login required constraint builder.Property(u => u.Password).IsRequired(); //password required constraint builder.Property(u => u.Email).HasMaxLength(30); //login size constraint builder.Property(u => u.Password).HasMaxLength(30); //password size constraint builder.Property(u => u.IsActivated).HasDefaultValue(false); //default value is activated builder.Property(u => u.ActivationCode).HasDefaultValue(ActivationHelper.GetActivationCode()); //default value activation code builder.Property(u => u.RegistrationDate).HasDefaultValueSql("now()").ValueGeneratedOnAdd(); //default value registration date }
private ActivationHelper BuildActivationHelper(Product product, ILicenseServerHelper licenseServerHelper = null) { if (licenseServerHelper == null) { licenseServerHelper = _licenseServerHelper; } var activationHelper = new ActivationHelper(product, licenseServerHelper); if (product == Product.PdfCreator) { activationHelper.AcceptExpiredActivation = true; activationHelper.Perpetual = true; } return(activationHelper); }
public async Task <DataResult <UserModel> > AddUserAsync(UserAuthDto user) { using (var context = new LangiumDbContext()) { try { var newUser = new UserModel() { Email = user.Email, Password = user.Password, ActivationCode = ActivationHelper.GetActivationCode(), Profile = new ProfileModel { Stats = new StatsModel(), Categories = new List <CategoryModel>() { new CategoryModel() { Name = "Unsorted Words" } } } }; var added = await context.Users.AddAsync(newUser); await context.SaveChangesAsync(); return(new DataResult <UserModel> (added.Entity)); } catch (Exception ex) { if (ex.InnerException.Message.Contains("23505")) { return(new DataResult <UserModel>(ex, "USER_AlREADY_EXISTS")); } else { return(new DataResult <UserModel>(ex, ex.InnerException.Message)); } } } }
public float[,,] BackPropagate(float[,,] gradientCostOverOutput, float learningFactor = 1f) { for (var i = 0; i < this.depth; ++i) { for (var j = 0; j < this.height; ++j) { for (var k = 0; k < this.width; ++k) { this.gradientCostOverInput[i, j, k] = gradientCostOverOutput[i, j, k] * ActivationHelper.ActivationGradient(this.output[i, j, k]); } } } return(this.gradientCostOverInput); }
public override object Activate(IEnumerable<KeyValuePair<string, object>> arguments, IPopulateComponentCallback callback, IServiceProvider services) { if (helper == null) helper = new ActivationHelper(method); var instance = helper.CreateInstance(method.ReturnType, arguments, callback, services); return instance; }