Example #1
0
        private byte[] SaveLoaderToBytes(IDataLoader loader)
        {
            Contracts.CheckValue(loader, nameof(loader));

            using (var stream = new MemoryStream())
            {
                LoaderUtils.SaveLoader(loader, stream);
                return(stream.GetBuffer());
            }
        }
Example #2
0
            protected IDataLoader CreateAndSaveLoader(Func <IHostEnvironment, IMultiStreamSource, IDataLoader> defaultLoaderFactory = null)
            {
                var loader = CreateLoader(defaultLoaderFactory);

                if (!string.IsNullOrWhiteSpace(Args.OutputModelFile))
                {
                    using (var file = Host.CreateOutputFile(Args.OutputModelFile))
                        LoaderUtils.SaveLoader(loader, file);
                }
                return(loader);
            }
Example #3
0
            protected IDataLoader CreateAndSaveLoader(string defaultLoader = "TextLoader")
            {
                var loader = CreateLoader(defaultLoader);

                if (!string.IsNullOrWhiteSpace(Args.OutputModelFile))
                {
                    using (var file = Host.CreateOutputFile(Args.OutputModelFile))
                        LoaderUtils.SaveLoader(loader, file);
                }
                return(loader);
            }
Example #4
0
 protected void SaveLoader(IDataLoader loader, string path)
 {
     using (var file = Host.CreateOutputFile(path))
         LoaderUtils.SaveLoader(loader, file);
 }