Class Tensor1D

All Implemented Interfaces:
Tensor, Serializable

public class Tensor1D extends TensorBase
One dimensional tensor - a vector or an array.
See Also:
  • Constructor Details

    • Tensor1D

      public Tensor1D(int size)
    • Tensor1D

      public Tensor1D(float... values)
      Creates a single row tensor with specified values.
      Parameters:
      values - values of column tensor
    • Tensor1D

      public Tensor1D(Shape shape, float[] values)
  • Method Details

    • get

      public final float get(int idx)
      Gets value from specified index position.
      Parameters:
      idx - position in tensor
      Returns:
      value at specified position
    • set

      public final void set(float val, int idx)
      Sets value at specified index position.
      Parameters:
      val -
      idx -
    • add

      public final void add(float value, int idx)
      Adds specified value to an element at specified index position in tensor.
      Parameters:
      value - value to add
      idx - element index
    • add

      public final Tensor1D add(Tensor1D toAdd)
    • copy

      public TensorBase copy()
      Overrides:
      copy in class TensorBase
    • clone

      public Object clone()
      Overrides:
      clone in class TensorBase
    • of

      public static Tensor1D of(float[] values)
      Create and return a 1D tensor of specified values.
      Parameters:
      values -
      Returns:
    • fromFile

      public static Tensor1D fromFile(String filePath) throws IOException
      Throws:
      IOException
    • toFile

      public void toFile(String filePath) throws IOException
      Throws:
      IOException
    • outerProduct

      public void outerProduct(Tensor1D otherTensor, Tensor2D result)