/// <summary> /// Compile the kernel. /// </summary> /// /// <param name="options">The options.</param> /// <param name="network">The network to compile for.</param> /// <param name="profile">The OpenCL training profile to use.</param> public void Compile(IDictionary <String, String> options, OpenCLTrainingProfile profile, FlatNetwork network) { IActivationFunction activation = network.ActivationFunctions[0]; StringBuilder source = new StringBuilder(); source.Append("#define ACTIVATION(x,slope)"); source.Append(activation.GetOpenCLExpression(false)); source.Append("\r\n"); source.Append("#define DERIVATIVE(x,slope)"); source.Append(activation.GetOpenCLExpression(true)); source.Append("\r\n"); source.Append(ResourceLoader.LoadString(SourceName)); CLSource = source.ToString(); Compile(options); profile.CalculateKernelParams(this, training); // setup Init(profile); }