@startuml
class Device {
	-String deviceType
	-int deviceId
}

class DataDesc {
	-String name
	-Device device
	-Shape shape
	-DataType dataType
	-SparseFormat sparseFormat
}

interface Model {
    +Block getGraph()
    +Parameter getParameter()
    +DataDesc[] describeInput()
    +DataDesc[] describeOutput()
    +Model cast(DataType dataType)
    +String[] listArtifacts()
    +String[] getArtifactNames()
    +URL getArtifact(String name)
    +InputStream getArtifactAsStream(String name)
    +void save(File modelPath, String modelName)
	.. static Manager methods ..
    +Model load(Path modelPath)
    +Model load(Path modelPath, String modelName)
    +Model load(Path modelPath, String modelName, Map options)
}

interface Translator<I, O> {
    +NDList processInput(TranslatorContext ctx, I input)
    +O processOutput(TranslatorContext ctx, NDList array)
}

interface Predictor<I, O> {
    +O predict(I input)
    +void setMetrics(Metrics metrics)
    +void close()
}

interface TranslatorContext {
    +Model getModel()
    +Device getDevice()
    +NDManager getNDManager()
    +void close()
}

interface NDManager {
    +NDArray create(Device device, ...);
    +NDArray create(DataDesc dataDesc);
}

interface NDArray {
    +byte[] getEncoded()
    +void encode(OutputStream os) throws IOException
    +DataDesc getDataDescriptor()
    +void set(Buffer data)
    +NDArray at(int index)
	.. other storage methods ..
    +more
}

Model -right-> DataDesc
Model o-down- Predictor : aggregation
Predictor -right-o Device : aggregation
Predictor -right-> Translator : uses
Translator -right-> NDArray : uses
Translator --> TranslatorContext : uses
NDManager -left-> NDArray
NDArray -down-o DataDesc

@enduml
