Class/Object

org.platanios.tensorflow.api.core

Slice

Related Docs: object Slice | package core

Permalink

case class Slice extends Indexer with Product with Serializable

Represents a slice object. A slice is a sequence of indices for some underlying sequence or tensor.

The companion object provides some helpful implicit conversion functions that allow for easy creation of slices.

For example:

3               // Slice object representing the following indices: '[3]'.
2 :: 6          // Slice object representing the following indices: '[2, 3, 4, 5]'.
3 :: 4 :: 12    // Slice object representing the following indices: '[3, 7, 10]'.
0 :: 1 :: -2    // Slice object representing the following indices: '[0, 3, 6, ..., length - 3]'.
6 :: -2 :: 3    // Slice object representing the following indices: '[6, 4]'.
-3 :: -2 :: -10 // Slice object representing the following indices: '[length - 3, length - 5, ..., length - 10]'.
2 :: -          // Slice object representing the following indices: '[2, 3, ..., length - 1]'.
0 :: 1 :: -     // Slice object representing the following indices: '[0, 3, 6, ..., length - 1]'.

Note how the end index is exclusive and the step size is optional.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Slice
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Indexer
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def assertWithinBounds(underlyingSequenceLength: Int): Unit

    Permalink

    Asserts that the indices specified by this slice are within the valid size bounds for the provided underlying sequence length.

    Asserts that the indices specified by this slice are within the valid size bounds for the provided underlying sequence length. Throws an IndexOutOfBoundsException exception if they are not.

    underlyingSequenceLength

    Underlying sequence length.

    Annotations
    @throws( ... ) @throws( ... )
    Exceptions thrown

    IllegalArgumentException If the underlying sequence length is not positive.

    IndexOutOfBoundsException If the indices specified by this slice are not within the valid size bounds for the provided underlying sequence length.

  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. val end: Int

    Permalink

    End index for this slice.

  8. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  9. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. val inclusive: Boolean

    Permalink

    Boolean value indicating whether this slice inclusive with respect to end or not.

  12. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  13. def length(underlyingSequenceLength: Int = 1): Int

    Permalink

    Length of this slice.

    Length of this slice.

    The length of a slice can only be computed if:

    • end - start has the same sign as step, or
    • the underlying sequence length is provided. Note that by underlying sequence we refer to the sequence that this slice is used to index.
    underlyingSequenceLength

    Underlying sequence length.

    Annotations
    @throws( ... ) @throws( ... )
    Exceptions thrown

    IllegalArgumentException If the underlying sequence length is not positive, or if the slice is invalid for some reason.

    IndexOutOfBoundsException If the indices specified by this slice are not within the valid size bounds for the provided underlying sequence length.

  14. def length: Int

    Permalink

    Length of this slice.

    Length of this slice.

    If end - start has the opposite sign of step, then the length of this slice is considered unknown and a value of -1 is returned. This can be avoided by providing the underlying sequence length in the length method of this class.

  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. val start: Int

    Permalink

    Start index for this slice.

  19. val step: Int

    Permalink

    Step for this slice.

  20. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  21. def toArray(underlyingSequenceLength: Int): Array[Int]

    Permalink

    Returns an array containing the indices represented by this slice, for the specified underlying sequence length.

    Returns an array containing the indices represented by this slice, for the specified underlying sequence length.

    This method takes case of negative indexing and the returned array is guaranteed to only have positive elements.

    underlyingSequenceLength

    Underlying sequence length.

    returns

    Array containing the indices represented by this slice, for the specified underlying sequence length.

    Annotations
    @throws( ... ) @throws( ... )
    Exceptions thrown

    IllegalArgumentException If the underlying sequence length is not positive.

    IndexOutOfBoundsException If the indices specified by this slice are not within the valid size bounds for the provided underlying sequence length.

  22. def toString(): String

    Permalink
    Definition Classes
    Slice → AnyRef → Any
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from Indexer

Inherited from AnyRef

Inherited from Any

Ungrouped