MCPcopy Create free account
hub / github.com/cogentcore/core / String

Method String

tensor/bits.go:322–343  ·  view source on GitHub ↗

String satisfies the fmt.Stringer interface for string of tensor data

()

Source from the content-addressed store, hash-verified

320
321// String satisfies the fmt.Stringer interface for string of tensor data
322func (tsr *Bits) String() string {
323 str := tsr.Label()
324 sz := tsr.Len()
325 if sz > 1000 {
326 return str
327 }
328 var b strings.Builder
329 b.WriteString(str)
330 b.WriteString("\n")
331 oddRow := true
332 rows, cols, _, _ := Projection2DShape(&tsr.Shp, oddRow)
333 for r := 0; r < rows; r++ {
334 rc, _ := Projection2DCoords(&tsr.Shp, oddRow, r, 0)
335 b.WriteString(fmt.Sprintf("%v: ", rc))
336 for c := 0; c < cols; c++ {
337 vl := Projection2DValue(tsr, oddRow, r, c)
338 b.WriteString(fmt.Sprintf("%g ", vl))
339 }
340 b.WriteString("\n")
341 }
342 return b.String()
343}

Callers

nothing calls this directly

Calls 7

LabelMethod · 0.95
LenMethod · 0.95
Projection2DShapeFunction · 0.85
Projection2DCoordsFunction · 0.85
Projection2DValueFunction · 0.85
WriteStringMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected