Record Class PartialRotaryEncoding.CosSin

java.lang.Object
java.lang.Record
smile.llm.model.qwen.PartialRotaryEncoding.CosSin
Record Components:
cos - [end, rotaryDim] cosine table.
sin - [end, rotaryDim] sine table.
All Implemented Interfaces:
AutoCloseable
Enclosing class:
PartialRotaryEncoding

public static record PartialRotaryEncoding.CosSin(Tensor cos, Tensor sin) extends Record implements AutoCloseable
Precomputed cos/sin tables for HF-style partial RoPE.
  • Constructor Summary

    Constructors
    Constructor
    Description
    CosSin(Tensor cos, Tensor sin)
    Creates an instance of a CosSin record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    cos()
    Returns the value of the cos record component.
    void
    Detaches both tables from every AutoScope on this thread.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    sin()
    Returns the value of the sin record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CosSin

      public CosSin(Tensor cos, Tensor sin)
      Creates an instance of a CosSin record class.
      Parameters:
      cos - the value for the cos record component
      sin - the value for the sin record component
  • Method Details

    • detachFromScopes

      public void detachFromScopes()
      Detaches both tables from every AutoScope on this thread.
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • cos

      public Tensor cos()
      Returns the value of the cos record component.
      Returns:
      the value of the cos record component
    • sin

      public Tensor sin()
      Returns the value of the sin record component.
      Returns:
      the value of the sin record component