Documentation of 'org.nd4j.linalg.util.Shape' Java class
Shape
org.nd4j.linalg.util

Class Shape



  • public class Shape
    extends java.lang.Object
    Encapsulates all shape related logic (vector of 0 dimension is a scalar is equivalent to a vector of length 1...)
    • Constructor Summary

      Constructors 
      Constructor and Description
      Shape() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean isColumnVectorShape(int[] shape) 
      static boolean isMatrix(int[] shape)
      Returns whether the passed in shape is a matrix
      static boolean isRowVectorShape(int[] shape) 
      static boolean isVector(int[] shape)
      Returns whether the given shape is a vector
      static int nonZeroDimension(int[] shape) 
      static boolean scalarEquals(int[] shape1, int[] shape2)
      Returns true if the given shapes are both scalars (0 dimension or shape[0] == 1)
      static boolean shapeEquals(int[] shape1, int[] shape2)
      Returns whether 2 shapes are equals by checking for dimension semantics as well as array equality
      static int[] sizeForAxes(int[] axes, int[] shape) 
      static int[] squeeze(int[] shape)
      Gets rid of any singleton dimensions of the given array
      static int[] squeeze(int[] shape, int[] stride)
      Gets rid of any singleton dimensions of the given array
      static boolean squeezeEquals(int[] test1, int[] test2)
      Returns true for the case where singleton dimensions are being compared
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Shape

        public Shape()
    • Method Detail

      • squeeze

        public static int[] squeeze(int[] shape,
                                    int[] stride)
        Gets rid of any singleton dimensions of the given array
        Parameters:
        shape - the shape to squeeze
        Returns:
        the array with all of the singleton dimensions removed
      • sizeForAxes

        public static int[] sizeForAxes(int[] axes,
                                        int[] shape)
      • isVector

        public static boolean isVector(int[] shape)
        Returns whether the given shape is a vector
        Parameters:
        shape - the shape to test
        Returns:
        whether the given shape is a vector
      • isMatrix

        public static boolean isMatrix(int[] shape)
        Returns whether the passed in shape is a matrix
        Parameters:
        shape - whether the passed in shape is a matrix
        Returns:
        true if the shape is a matrix false otherwise
      • squeeze

        public static int[] squeeze(int[] shape)
        Gets rid of any singleton dimensions of the given array
        Parameters:
        shape - the shape to squeeze
        Returns:
        the array with all of the singleton dimensions removed
      • nonZeroDimension

        public static int nonZeroDimension(int[] shape)
      • shapeEquals

        public static boolean shapeEquals(int[] shape1,
                                          int[] shape2)
        Returns whether 2 shapes are equals by checking for dimension semantics as well as array equality
        Parameters:
        shape1 - the first shape for comparison
        shape2 - the second shape for comparison
        Returns:
        whether the shapes are equivalent
      • scalarEquals

        public static boolean scalarEquals(int[] shape1,
                                           int[] shape2)
        Returns true if the given shapes are both scalars (0 dimension or shape[0] == 1)
        Parameters:
        shape1 - the first shape for comparison
        shape2 - the second shape for comparison
        Returns:
        whether the 2 shapes are equal based on scalar rules
      • isRowVectorShape

        public static boolean isRowVectorShape(int[] shape)
      • isColumnVectorShape

        public static boolean isColumnVectorShape(int[] shape)
      • squeezeEquals

        public static boolean squeezeEquals(int[] test1,
                                            int[] test2)
        Returns true for the case where singleton dimensions are being compared
        Parameters:
        test1 - the first to test
        test2 - the second to test
        Returns:
        true if the arrays are equal with the singleton dimension omitted

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.