TensorLabel.fromMap constructor
TensorLabel.fromMap(
- Map<
int, List< axisLabels,String> > - TensorBuffer tensorBuffer
Implementation
TensorLabel.fromMap(
Map<int, List<String>> axisLabels, TensorBuffer tensorBuffer) {
SupportPreconditions.checkNotNull(axisLabels,
message: "Axis labels cannot be null.");
SupportPreconditions.checkNotNull(tensorBuffer,
message: "Tensor Buffer cannot be null.");
_axisLabels = axisLabels;
_tensorBuffer = tensorBuffer;
_shape = tensorBuffer.getShape();
axisLabels.forEach((axis, labels) {
SupportPreconditions.checkArgument(axis >= 0 && axis < _shape.length,
errorMessage: "Invalid axis id: $axis");
SupportPreconditions.checkNotNull(labels,
message: "Label list is null on axis: $axis");
SupportPreconditions.checkArgument(_shape[axis] == labels.length,
errorMessage: "Label number " +
"${labels.length} mismatch the shape on axis $axis");
});
}