docs: @Override
    public SparseTensor elementwiseProduct(Tensor other) {
      int[] dimensionNums = getDimensionNumbers();
      int[] dimensionSizes = getDimensionSizes();
      int[] otherDimensions = other.getDimensionNumbers();
      int[] otherSizes = other.getDimensionSizes();
      
      // Check that dimensionNums contains a superset of otherDimensions
      int myInd = 0, otherInd = 0;
      int myLength = dimensionNums.length;
      int otherLength = otherDimensions.length;
      while (myInd < myLength && otherInd < otherLength) {
        if (dimensionNums[myInd] < otherDimensions[otherInd]) {
          myInd++;
        } else if (dimensionNums[myInd] == otherDimensions[otherInd]) {
          Preconditions.checkArgument(dimensionSizes[myInd] == otherSizes[otherInd],
                                      "dimensionSizes[myInd]: %s\notherSizes[otherInd]: %s",
                                      dimensionSizes[myInd], otherSizes[otherInd]);
          myInd++;
          otherInd++;
        } else {
          // Not a superset.
          Preconditions.checkArgument(false, "Dimensions not a superset");
        }
      }
  
      // There are three possible multiplication implementations: an extremely
      // fast one for the case when both sets of dimensions are exactly equal,
      // a pretty fast one for when the dimensions of other line up
      // against the leftmost dimensions of this, and another for all
      // other cases. Check which case applies, then use the
      // fastest possible algorithm.
      for (int i = 0; i < otherDimensions.length; i++) {
        if (otherDimensions[i] != dimensionNums[i]) {
          // Not left aligned.
          return elementwiseMultiplyNaive(this, other);
        }
      }
  
      if (otherDimensions.length == dimensionNums.length) {
        // Both tensors contain the exact same set of dimensions
        return elementwiseMultiplySparseDense(this, other);
      } else {
        // Dimensions of other are aligned with the leftmost dimensions
        // of this tensor.
        return elementwiseMultiplyLeftAligned(this, other);
      }
    }