### Question:
TensorShapeValidation { public static boolean isBroadcastable(long[] left, long[] right) { try { TensorShape.getBroadcastResultShape(left, right); return true; } catch (IllegalArgumentException e) { return false; } } private  TensorShapeValidation(); static void checkTensorsMatchNonLengthOneShapeOrAreLengthOne(long[] proposalShape, long[]... shapes); static void checkDimensionExistsInShape(int dimension, long[] shape); static void checkTensorsAreScalar(String message, long[]... shapes); static long[] checkHasOneNonLengthOneShapeOrAllLengthOne(long[]... shapes); static boolean isBroadcastable(long[] left, long[] right); static boolean isBroadcastable(long[] a, long[]... b); static long[] checkTernaryConditionShapeIsValid(long[] predicate, long[] thn, long[] els); static void checkShapeIsSquareMatrix(long[] shape); static void checkShapesMatch(long[] actual, long[] expected); static long[] checkAllShapesMatch(long[]... shapes); static long[] checkAllShapesMatch(String errorMessage, long[]... shapes); static long[] checkAllShapesMatch(String errorMessage, Collection<long[]> shapes); static long[] checkAllShapesMatch(Collection<long[]> shapes); static long[] checkShapesCanBeConcatenated(int dimension, long[]... shapes); static void checkIndexIsValid(long[] shape, long... index); static long[] getMatrixMultiplicationResultingShape(long[] left, long[] right, boolean transposeLeft, boolean transposeRight);  }### Answer:
@Test public void checkIsBroadcastableWith1AndExtraRank() { long[] a = new long[]{2, 1, 2, 2}; long[] b = new long[]{3, 2, 2}; assertTrue(TensorShapeValidation.isBroadcastable(a, b)); }
@Test public void checkIsNotBroadcastableWithShapeMismatch() { long[] a = new long[]{2, 1, 2, 2}; long[] b = new long[]{4, 3, 2, 2}; assertFalse(TensorShapeValidation.isBroadcastable(a, b)); }
@Test public void checkScalarIsBroadcastable() { long[] a = new long[]{}; long[] b = new long[]{4, 3, 2, 2}; assertTrue(TensorShapeValidation.isBroadcastable(a, b)); }