paddings tensor for the first dimension(by default None, meaning zero padding).
paddings tensor for the first dimension(by default None, meaning zero padding).
Feature Padding param for MiniBatch.
For constructing a mini batch, we need to make sure all samples' feature and label in this mini batch have the same size. If the size is different, we will pad them to the same size.
By default, we will pad the first dimension to the longest size with zero in the MiniBatch. If you want to specify the padding values, you can set
paddingTensor; If you want to specify the padding length, you can usePaddingLongestorFixedLength.For example, your feature size is n*m*k, you should provide a 2D tensor in a size of m*k. If your feature is 1D, you can provide a one-element 1D tensor.
For example, we have 3 Sample, and convert them into a MiniBatch. Sample1's feature is a 2*3 tensor {1, 2, 3, 4, 5, 6}
Sample2's feature is a 1*3 tensor {7, 8, 9}
Sample3's feature is a 3*3 tensor {10, 11, 12, 13, 14, 15, 16, 17, 18}
And the paddingTensor is {-1, -2, -3}, use
FixedLength(Array(4)), the MiniBatch will be a tensor of 3*4*3: {1, 2, 3, 4, 5, 6, -1, -2, -3, -1, -2, -37, 8, 9, -1, -2, -3, -1, -2, -3, -1, -2, -3
10, 11, 12, 13, 14, 15, 16, 17, 18 -1, -2, -3}
numeric type
paddings tensor for the first dimension(by default None, meaning zero padding).
See PaddingLongest, FixedLength