String satisfies the fmt.Stringer interface for string of tensor data
()
| 320 | |
| 321 | // String satisfies the fmt.Stringer interface for string of tensor data |
| 322 | func (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 | } |
nothing calls this directly
no test coverage detected