Package org.nd4j.graph.ui
Class LogFileWriter
- java.lang.Object
-
- org.nd4j.graph.ui.LogFileWriter
-
public class LogFileWriter extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LogFileWriter.EventSubtype
static class
LogFileWriter.StaticInfo
-
Constructor Summary
Constructors Constructor Description LogFileWriter(File file)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
encodeGraphStructure(com.google.flatbuffers.FlatBufferBuilder fbb, SameDiff sd)
protected Pair<Integer,com.google.flatbuffers.FlatBufferBuilder>
encodeStaticHeader(byte type)
Encode the header as a UIStaticInfoRecord instance for the specificUIEventType
List<Pair<UIEvent,com.google.flatbuffers.Table>>
readEvents()
Read all of the events.List<Pair<UIEvent,com.google.flatbuffers.Table>>
readEvents(long startOffset)
Read all of the events starting at a specific file offsetLogFileWriter.StaticInfo
readStatic()
Read all static information at the start of the fileboolean
registeredEventName(String name)
long
registerEventName(String name)
Register the event name - "accuracy", "loss", etc for later use in recording events.long
registerEventNameQuiet(String name)
long
writeFinishStaticMarker()
Write marker for final static datalong
writeGraphStructure(SameDiff sd)
Write the graph structurelong
writeHistogramEventCustomBins(String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, INDArray bins, INDArray y)
long
writeHistogramEventDiscrete(@NonNull String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, List<String> binLabels, @NonNull INDArray y)
long
writeHistogramEventEqualSpacing(String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, double min, double max, INDArray y)
long
writeScalarEvent(String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, Number scalar)
Write a single scalar event to the file
-
-
-
Constructor Detail
-
LogFileWriter
public LogFileWriter(File file) throws IOException
- Throws:
IOException
-
-
Method Detail
-
writeGraphStructure
public long writeGraphStructure(SameDiff sd) throws IOException
Write the graph structure- Parameters:
sd
- SameDiff instance to write the graph structure for- Returns:
- Number of bytes written
- Throws:
IOException
-
writeFinishStaticMarker
public long writeFinishStaticMarker() throws IOException
Write marker for final static data- Returns:
- Throws:
IOException
-
readStatic
public LogFileWriter.StaticInfo readStatic() throws IOException
Read all static information at the start of the file- Returns:
- Throws:
IOException
-
readEvents
public List<Pair<UIEvent,com.google.flatbuffers.Table>> readEvents() throws IOException
Read all of the events.- Returns:
- All of the UI events
- Throws:
IOException
-
readEvents
public List<Pair<UIEvent,com.google.flatbuffers.Table>> readEvents(long startOffset) throws IOException
Read all of the events starting at a specific file offset- Returns:
- All of the UI events
- Throws:
IOException
-
registeredEventName
public boolean registeredEventName(String name)
-
registerEventNameQuiet
public long registerEventNameQuiet(String name)
-
registerEventName
public long registerEventName(String name) throws IOException
Register the event name - "accuracy", "loss", etc for later use in recording events.- Parameters:
name
- Name to register- Returns:
- Number of bytes written
- Throws:
IOException
-
writeScalarEvent
public long writeScalarEvent(String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, Number scalar) throws IOException
Write a single scalar event to the file- Parameters:
name
- Name of the event. Must be registered byregisterEventName(String)
first!time
- Timestampiteration
- Iteration for the eventepoch
- Epoch for the eventscalar
- Scalar value to write- Returns:
- Number of bytes written
- Throws:
IOException
-
writeHistogramEventDiscrete
public long writeHistogramEventDiscrete(@NonNull @NonNull String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, List<String> binLabels, @NonNull @NonNull INDArray y) throws IOException
- Throws:
IOException
-
writeHistogramEventEqualSpacing
public long writeHistogramEventEqualSpacing(String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, double min, double max, INDArray y) throws IOException
- Throws:
IOException
-
writeHistogramEventCustomBins
public long writeHistogramEventCustomBins(String name, LogFileWriter.EventSubtype subtype, long time, int iteration, int epoch, INDArray bins, INDArray y) throws IOException
- Throws:
IOException
-
encodeStaticHeader
protected Pair<Integer,com.google.flatbuffers.FlatBufferBuilder> encodeStaticHeader(byte type)
Encode the header as a UIStaticInfoRecord instance for the specificUIEventType
- Parameters:
type
- UIEventType
-
encodeGraphStructure
protected int encodeGraphStructure(com.google.flatbuffers.FlatBufferBuilder fbb, SameDiff sd)
-
-