Class SDRandom


  • public class SDRandom
    extends SDOps
    • Field Summary

      • Fields inherited from class org.nd4j.autodiff.samediff.ops.SDOps

        sd
    • Constructor Summary

      Constructors 
      Constructor Description
      SDRandom​(SameDiff sameDiff)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SDVariable bernoulli​(double p, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Bernoulli distribution,
      with the specified probability.
      SDVariable bernoulli​(String name, double p, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Bernoulli distribution,
      with the specified probability.
      SDVariable binomial​(int nTrials, double p, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Binomial distribution,
      with the specified number of trials and probability.
      SDVariable binomial​(String name, int nTrials, double p, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Binomial distribution,
      with the specified number of trials and probability.
      SDVariable exponential​(double lambda, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a exponential distribution:
      P(x) = lambda * exp(-lambda * x)
      Inputs must satisfy the following constraints:
      Must be positive: lambda > 0
      SDVariable exponential​(String name, double lambda, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a exponential distribution:
      P(x) = lambda * exp(-lambda * x)
      Inputs must satisfy the following constraints:
      Must be positive: lambda > 0
      SDVariable logNormal​(double mean, double stddev, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Log Normal distribution,
      i.e., log(x) ~ N(mean, stdev)
      SDVariable logNormal​(String name, double mean, double stddev, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Log Normal distribution,
      i.e., log(x) ~ N(mean, stdev)
      SDVariable normal​(double mean, double stddev, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
      N(mean, stdev)
      SDVariable normal​(String name, double mean, double stddev, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
      N(mean, stdev)
      SDVariable normalTruncated​(double mean, double stddev, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
      N(mean, stdev).
      SDVariable normalTruncated​(String name, double mean, double stddev, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
      N(mean, stdev).
      SDVariable uniform​(double min, double max, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a uniform distribution,
      U(min,max)
      SDVariable uniform​(String name, double min, double max, DataType datatype, long... shape)
      Generate a new random INDArray, where values are randomly sampled according to a uniform distribution,
      U(min,max)
    • Constructor Detail

      • SDRandom

        public SDRandom​(SameDiff sameDiff)
    • Method Detail

      • bernoulli

        public SDVariable bernoulli​(double p,
                                    DataType datatype,
                                    long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Bernoulli distribution,
        with the specified probability. Array values will have value 1 with probability P and value 0 with probability
        1-P.
        Parameters:
        p - Probability of value 1
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • bernoulli

        public SDVariable bernoulli​(String name,
                                    double p,
                                    DataType datatype,
                                    long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Bernoulli distribution,
        with the specified probability. Array values will have value 1 with probability P and value 0 with probability
        1-P.
        Parameters:
        name - name May be null. Name for the output variable
        p - Probability of value 1
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • binomial

        public SDVariable binomial​(int nTrials,
                                   double p,
                                   DataType datatype,
                                   long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Binomial distribution,
        with the specified number of trials and probability.
        Parameters:
        nTrials - Number of trials parameter for the binomial distribution
        p - Probability of success for each trial
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • binomial

        public SDVariable binomial​(String name,
                                   int nTrials,
                                   double p,
                                   DataType datatype,
                                   long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Binomial distribution,
        with the specified number of trials and probability.
        Parameters:
        name - name May be null. Name for the output variable
        nTrials - Number of trials parameter for the binomial distribution
        p - Probability of success for each trial
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • exponential

        public SDVariable exponential​(double lambda,
                                      DataType datatype,
                                      long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a exponential distribution:
        P(x) = lambda * exp(-lambda * x)
        Inputs must satisfy the following constraints:
        Must be positive: lambda > 0
        Parameters:
        lambda - lambda parameter
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • exponential

        public SDVariable exponential​(String name,
                                      double lambda,
                                      DataType datatype,
                                      long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a exponential distribution:
        P(x) = lambda * exp(-lambda * x)
        Inputs must satisfy the following constraints:
        Must be positive: lambda > 0
        Parameters:
        name - name May be null. Name for the output variable
        lambda - lambda parameter
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • logNormal

        public SDVariable logNormal​(double mean,
                                    double stddev,
                                    DataType datatype,
                                    long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Log Normal distribution,
        i.e., log(x) ~ N(mean, stdev)
        Parameters:
        mean - Mean value for the random array
        stddev - Standard deviation for the random array
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • logNormal

        public SDVariable logNormal​(String name,
                                    double mean,
                                    double stddev,
                                    DataType datatype,
                                    long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Log Normal distribution,
        i.e., log(x) ~ N(mean, stdev)
        Parameters:
        name - name May be null. Name for the output variable
        mean - Mean value for the random array
        stddev - Standard deviation for the random array
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • normal

        public SDVariable normal​(double mean,
                                 double stddev,
                                 DataType datatype,
                                 long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
        N(mean, stdev)
        Parameters:
        mean - Mean value for the random array
        stddev - Standard deviation for the random array
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • normal

        public SDVariable normal​(String name,
                                 double mean,
                                 double stddev,
                                 DataType datatype,
                                 long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
        N(mean, stdev)
        Parameters:
        name - name May be null. Name for the output variable
        mean - Mean value for the random array
        stddev - Standard deviation for the random array
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • normalTruncated

        public SDVariable normalTruncated​(double mean,
                                          double stddev,
                                          DataType datatype,
                                          long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
        N(mean, stdev). However, any values more than 1 standard deviation from the mean are dropped and re-sampled
        Parameters:
        mean - Mean value for the random array
        stddev - Standard deviation for the random array
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • normalTruncated

        public SDVariable normalTruncated​(String name,
                                          double mean,
                                          double stddev,
                                          DataType datatype,
                                          long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a Gaussian (normal) distribution,
        N(mean, stdev). However, any values more than 1 standard deviation from the mean are dropped and re-sampled
        Parameters:
        name - name May be null. Name for the output variable
        mean - Mean value for the random array
        stddev - Standard deviation for the random array
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • uniform

        public SDVariable uniform​(double min,
                                  double max,
                                  DataType datatype,
                                  long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a uniform distribution,
        U(min,max)
        Parameters:
        min - Minimum value
        max - Maximum value.
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)
      • uniform

        public SDVariable uniform​(String name,
                                  double min,
                                  double max,
                                  DataType datatype,
                                  long... shape)
        Generate a new random INDArray, where values are randomly sampled according to a uniform distribution,
        U(min,max)
        Parameters:
        name - name May be null. Name for the output variable
        min - Minimum value
        max - Maximum value.
        datatype - Data type of the output variable
        shape - Shape of the new random INDArray, as a 1D array (Size: AtLeast(min=0))
        Returns:
        output Tensor with the given shape where values are randomly sampled according to a %OP_NAME% distribution (NUMERIC type)