From 7e4799eb52e185af1808a6e8dcd49695d4762348 Mon Sep 17 00:00:00 2001 From: sugarme Date: Thu, 28 Apr 2022 17:39:46 +1000 Subject: [PATCH] improved ts.Format() info --- ts/print.go | 4 +++- ts/print_test.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ts/print.go b/ts/print.go index d26637a..fd4dd38 100644 --- a/ts/print.go +++ b/ts/print.go @@ -319,13 +319,15 @@ func (ts *Tensor) Format(s fmt.State, verb rune) { strides := shapeToStrides(shape) device := ts.MustDevice() dtype := ts.DType().String() + defined := ts.MustDefined() if verb == 'i' { fmt.Fprintf( s, - "\nTENSOR META:\n\tShape:\t\t%v\n\tDType:\t\t%v\n\tDevice:\t\t%v\n", + "\nTENSOR INFO:\n\tShape:\t\t%v\n\tDType:\t\t%v\n\tDevice:\t\t%v\n\tDefined:\t%v\n", shape, dtype, device, + defined, ) return } diff --git a/ts/print_test.go b/ts/print_test.go index 07fbf05..681d24d 100644 --- a/ts/print_test.go +++ b/ts/print_test.go @@ -15,5 +15,7 @@ func TestTensor_Format(t *testing.T) { x := ts.MustArange(ts.IntScalar(numels), gotch.Float, gotch.CPU).MustView(shape, true) fmt.Printf("%0.1f", x) // print truncated data + fmt.Printf("%i", x) // print truncated data + // fmt.Printf("%#0.1f", x) // print full data }