MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MemoryCollectionFactory.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Threading.Tasks;
6
8{
13 {
22 public static IMemoryCollection CreateMemory(MEMTYPE type, int nMax, float fAlpha = 0, string strFile = null)
23 {
24 switch (type)
25 {
26 case MEMTYPE.LOADING:
27 if (string.IsNullOrEmpty(strFile))
28 throw new Exception("You must specify a file.");
29 return new FileMemoryCollection(nMax, true, false, strFile);
30
31 case MEMTYPE.SAVING:
32 if (string.IsNullOrEmpty(strFile))
33 throw new Exception("You must specify a file.");
34 return new FileMemoryCollection(nMax, false, true, strFile);
35
36 case MEMTYPE.PRIORITY:
37 return new PrioritizedMemoryCollection(nMax, fAlpha);
38
39 default:
40 return new RandomMemoryCollection(nMax);
41 }
42 }
43 }
44}
The FileMemoryCollection is used during debugging to load from and save to file.
The MemoryCollectionFactory is used to create various memory collection types.
static IMemoryCollection CreateMemory(MEMTYPE type, int nMax, float fAlpha=0, string strFile=null)
CreateMemory creates the memory collection type based on the MEMTYPE parameter.
The PrioritizedMemoryCollection provides a sampling based on prioritizations.
The RandomMemoryCollection is used to randomly sample the collection of items.
The IMemoryCollection interface is implemented by all memory collection types.
Definition: Interfaces.cs:37
MEMTYPE
Specifies the type of memory collection to use.
Definition: Interfaces.cs:14