Class Tensor


  • public class Tensor
    extends Wrapper
    Tensor API holding host memory

    It can throw exceptions safely for the application, where it is properly handled.

    • Constructor Summary

      Constructors 
      Constructor Description
      Tensor​(int[] dims, float[] data)  
      Tensor​(long addr)  
      Tensor​(ElementType type, int[] dims, long cArray)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float[] data()
      Returns a tensor data as floating point array.
      protected void delete​(long nativeObj)  
      int[] get_shape()
      Returns a tensor shape
      int get_size()
      Returns the total number of elements (a product of all the dims or 1 for scalar)
      • Methods inherited from class java.lang.Object

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

      • Tensor

        public Tensor​(long addr)
      • Tensor

        public Tensor​(ElementType type,
                      int[] dims,
                      long cArray)
      • Tensor

        public Tensor​(int[] dims,
                      float[] data)
    • Method Detail

      • get_size

        public int get_size()
        Returns the total number of elements (a product of all the dims or 1 for scalar)
        Returns:
        The total number of elements
      • get_shape

        public int[] get_shape()
        Returns a tensor shape
      • data

        public float[] data()
        Returns a tensor data as floating point array.
      • delete

        protected void delete​(long nativeObj)
        Overrides:
        delete in class Wrapper