Make ShapedArray.description's maxScalarCountPerLine user-customizable #1168
Description
Here is ShapedArray
's fileprivate func description( indentLevel: Int, edgeElementCount: Int, maxScalarLength: Int, maxScalarCountPerLine: Int, summarizing: Bool ) -> String
.
Is there any reason this is marked fileprivate
? It's currently accessible only via the public func description( lineWidth: Int = 80, edgeElementCount: Int = 3, summarizing: Bool = false )
where the maxScalarCountPerLine
is calculated for me:
let maxScalarCountPerLine = Swift.max(1, lineWidth / maxScalarLength)
Calculating the maxScalarCountPerLine
independently for each Tensor leads to this problem:
=== Feature 0:
input:
[ -0.022060618, 0.024561103, -0.025651768, -0.04885944, 0.012175075, 0.006922609, -0.0516627,
-0.019092154, 0.024305645, -0.028501112, -0.047275346, 0.014285761, 0.00435431, -0.052575804,
-0.01609808, 0.023822624, -0.031269953, -0.04550122, 0.016227337, 0.0016748396, -0.05326795,
-0.013095862, 0.02311485, -0.03394214, -0.043547418, 0.017988473, -0.001100175, -0.053735107,
-0.010103013, 0.022186458, -0.036502086, -0.0, 0.0, -0.0039545433, -0.053974554]
output:
[ -0.0, 0.0, -0.0, -0.0, 0.0, -0.0, -0.0, -0.0, -0.0,
-0.0, -0.0, 0.0, 0.0, -0.0, 0.0, -0.0, -0.0, 0.0,
0.0, 0.0, -0.0, -0.0, 0.0, 0.0, 0.0, 0.0, -0.0,
-0.0, 0.0, 0.0, -0.0, -1.6888539, -0.99011576, 0.0, 0.0]
target:
[ -0.0, 0.0, -0.0, -0.0, 0.0, 0.0, -0.0, -0.0,
0.0, -0.0, -0.0, 0.0, 0.0, -0.0, -0.0, 0.0,
-0.0, -0.0, 0.0, 0.0, -0.0, -0.0, 0.0, -0.0,
-0.0, 0.0, -0.0, -0.0, -0.0, 0.0, -0.0, -0.041425332,
0.019558901, -0.0, -0.0]
Each Tensor has a different number of scalars per line, so the values are visually shifted in each of the three descriptions. This makes it difficult to visually inspect the values at the same position in each tensor.
I would like to be able to force the max number of scalars per line for each Tensor
so that the values are more readily visually comparable.