Ejemplo n.º 1
0
        /**
         * This method initializes and sets current session context from
         * the specified {@code context settings} ({@link ContextSettings}).
         * After invocation of this method, all the tensors that exist in
         * the current thread will be invalidated.
         *
         * @return created context
         */
        public static Context InitializeNew(ContextSettings contextSettings)
        {
            var context = new Context(contextSettings);

            ThreadLocalContext = context;
            return(context);
        }
Ejemplo n.º 2
0
        /**
         * Creates context from the settings
         *
         * @param contextSettings settings
         * @see ContextSettings
         */
        public Context(ContextSettings contextSettings)
        {
            parseManager     = new ParseManager(contextSettings.getParser());
            converterManager = contextSettings.getConverterManager();
            nameManager      = new NameManager(contextSettings.getNameManagerSeed(), contextSettings.getKronecker(), contextSettings.getMetricName());

            defaultOutputFormat = contextSettings.getDefaultOutputFormat();

            foreach (IndexType type in contextSettings.MetricTypes)
            {
                metricTypes.Set(type.GetType().GetHashCode());
            }
        }