Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

14: Logs and sinks

E1401

Logs record has no such metric. r.name reads, or Name(name=…) gives, a metric that the logs record doesn’t declare. The help suggests a metric with a similar name.

logs StepLogs:
    loss: [] mean

fn step(x: [n]) -> StepLogs = StepLogs(los=sum(x))

See Records.

E1402

Invalid logs metric. A metric of a logs declaration isn’t a single number (a [] tensor or an int, float or bool); doesn’t end with how its values combine, or ends with a word other than mean, sum, max, min or last; or its name is a Python keyword or starts with _.

dim D = 64

logs StepLogs:
    loss: [D] mean

See Logs declarations.

E1403

Value isn’t the expected logs record. A parameter or return type is a logs record and the value is another record or something else, or sink.write is given something other than a logs record. Records are matched by name.

logs StepLogs:
    loss: [] mean

fn report(sink: LogSink, x: [n]):
    sink.write(sum(x))

See Records and Sinks.

E1404

Value isn’t a LogSink. A LogSink parameter or return type got a tensor, a model or a logs record. A sink is a Python object with a write(dict) method, passed in from Python.

logs StepLogs:
    loss: [] mean

fn report(sink: LogSink, l: []) = sink.write(StepLogs(loss=l))

fn f(x: [n]) = report(x, sum(x))

See Sinks.