improved ts.Format() info
This commit is contained in:
parent
ce421dd4c5
commit
7e4799eb52
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user