Class/Object

com.intel.analytics.zoo.pipeline.api.keras.layers

Embedding

Related Docs: object Embedding | package layers

Permalink

class Embedding[T] extends bigdl.nn.keras.Embedding[T] with Net

Turn non-negative integers (indices) into dense vectors of fixed size. The input of this layer should be 2D.

This layer can only be used as the first layer in a model, you need to provide the argument inputShape (a Single Shape, does not include the batch dimension).

T

Numeric type of parameter(e.g. weight, bias). Only support float/double now.

Linear Supertypes
Net, bigdl.nn.keras.Embedding[T], KerasLayer[Tensor[T], Tensor[T], T], Container[Tensor[T], Tensor[T], T], AbstractModule[Tensor[T], Tensor[T], T], InferShape, Serializable, Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Embedding
  2. Net
  3. Embedding
  4. KerasLayer
  5. Container
  6. AbstractModule
  7. InferShape
  8. Serializable
  9. Serializable
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Embedding(inputDim: Int, outputDim: Int, init: InitializationMethod = RandomUniform, initWeights: Tensor[T] = null, trainable: Boolean = true, wRegularizer: Regularizer[T] = null, inputShape: Shape = null, maskZero: Boolean = false, paddingValue: Int = 0, zeroBasedId: Boolean = true)(implicit arg0: ClassTag[T], ev: TensorNumeric[T])

    Permalink

    inputDim

    Int > 0. Size of the vocabulary, ie. 1 + maximum integer index occurring in the input data. Each word index in the input should be within range [0, inputDim-1].

    outputDim

    Int > 0. Dimension of the dense embedding.

    init

    Initialization method for the weights of the layer. Default is RandomUniform. You can also pass in corresponding string representations such as 'uniform' or 'normal', etc. for simple init methods in the factory method.

    initWeights

    Tensor. Initial weights set to this layer, which should be a Tensor of size (inputDim, outputDim). Default is null and in this case weights are initialized by the initialization method specified by 'init'. Otherwise, 'weights' will override 'init' to take effect.

    trainable

    Whether this layer is trainable or not. Default is true.

    wRegularizer

    An instance of Regularizer, (eg. L1 or L2 regularization), applied to the embedding matrix. Default is null.

    inputShape

    A Single Shape, does not include the batch dimension.

    paddingValue

    padding value, default 0

    zeroBasedId

    default true and input should be 0 based. Otherwise need to be 1 base

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. def accGradParameters(input: Tensor[T], gradOutput: Tensor[T]): Unit

    Permalink
    Definition Classes
    KerasLayer → AbstractModule
  5. def apply(name: String): Option[AbstractModule[Activity, Activity, T]]

    Permalink
    Definition Classes
    Container → AbstractModule
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def backward(input: Tensor[T], gradOutput: Tensor[T]): Tensor[T]

    Permalink
    Definition Classes
    AbstractModule
  8. var backwardTime: Long

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  9. def build(calcInputShape: Shape): Shape

    Permalink
    Definition Classes
    KerasLayer → InferShape
  10. def canEqual(other: Any): Boolean

    Permalink
    Definition Classes
    Container → AbstractModule
  11. final def checkEngineType(): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  12. def clearState(): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  13. final def clone(deepCopy: Boolean): AbstractModule[Tensor[T], Tensor[T], T]

    Permalink
    Definition Classes
    AbstractModule
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. final def cloneModule(): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  16. def computeOutputShape(inputShape: Shape): Shape

    Permalink
    Definition Classes
    Embedding → KerasLayer → InferShape
  17. def doBuild(inputShape: Shape): AbstractModule[Tensor[T], Tensor[T], T]

    Permalink
    Definition Classes
    Embedding → Embedding → KerasLayer
  18. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. def equals(other: Any): Boolean

    Permalink
    Definition Classes
    Container → AbstractModule → AnyRef → Any
  20. final def evaluate(): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  21. final def evaluate(dataSet: LocalDataSet[MiniBatch[T]], vMethods: Array[_ <: ValidationMethod[T]]): Array[(ValidationResult, ValidationMethod[T])]

    Permalink
    Definition Classes
    AbstractModule
  22. final def evaluate(dataset: RDD[MiniBatch[T]], vMethods: Array[_ <: ValidationMethod[T]]): Array[(ValidationResult, ValidationMethod[T])]

    Permalink
    Definition Classes
    AbstractModule
  23. final def evaluate(dataset: RDD[Sample[T]], vMethods: Array[_ <: ValidationMethod[T]], batchSize: Option[Int]): Array[(ValidationResult, ValidationMethod[T])]

    Permalink
    Definition Classes
    AbstractModule
  24. final def evaluateImage(imageFrame: ImageFrame, vMethods: Array[_ <: ValidationMethod[T]], batchSize: Option[Int]): Array[(ValidationResult, ValidationMethod[T])]

    Permalink
    Definition Classes
    AbstractModule
  25. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. def findModules(moduleType: String): ArrayBuffer[AbstractModule[_, _, T]]

    Permalink
    Definition Classes
    Container
  27. final def forward(input: Tensor[T]): Tensor[T]

    Permalink
    Definition Classes
    AbstractModule
  28. var forwardTime: Long

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  29. def freeze(names: String*): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  30. def from[T](vars: Variable[T]*)(implicit arg0: ClassTag[T], ev: TensorNumeric[T]): Variable[T]

    Permalink

    Build graph: some other modules point to current module

    Build graph: some other modules point to current module

    vars

    upstream variables

    returns

    Variable containing current module

    Definition Classes
    Net
  31. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  32. def getExtraParameter(): Array[Tensor[T]]

    Permalink
    Definition Classes
    Container → AbstractModule
  33. final def getInputShape(): Shape

    Permalink
    Definition Classes
    InferShape
  34. final def getName(): String

    Permalink
    Definition Classes
    AbstractModule
  35. final def getNumericType(): TensorDataType

    Permalink
    Definition Classes
    AbstractModule
  36. final def getOutputShape(): Shape

    Permalink
    Definition Classes
    InferShape
  37. def getParametersTable(): Table

    Permalink
    Definition Classes
    Container → AbstractModule
  38. final def getPrintName(): String

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  39. final def getScaleB(): Double

    Permalink
    Definition Classes
    AbstractModule
  40. final def getScaleW(): Double

    Permalink
    Definition Classes
    AbstractModule
  41. def getTimes(): Array[(AbstractModule[_ <: Activity, _ <: Activity, T], Long, Long)]

    Permalink
    Definition Classes
    Container → AbstractModule
  42. final def getTimesGroupByModuleType(): Array[(String, Long, Long)]

    Permalink
    Definition Classes
    AbstractModule
  43. final def getWeightsBias(): Array[Tensor[T]]

    Permalink
    Definition Classes
    AbstractModule
  44. var gradInput: Tensor[T]

    Permalink
    Definition Classes
    AbstractModule
  45. final def hasName: Boolean

    Permalink
    Definition Classes
    AbstractModule
  46. def hashCode(): Int

    Permalink
    Definition Classes
    Container → AbstractModule → AnyRef → Any
  47. val init: InitializationMethod

    Permalink

    Initialization method for the weights of the layer.

    Initialization method for the weights of the layer. Default is RandomUniform. You can also pass in corresponding string representations such as 'uniform' or 'normal', etc. for simple init methods in the factory method.

    Definition Classes
    Embedding → Embedding
  48. val initWeights: Tensor[T]

    Permalink

    Tensor.

    Tensor. Initial weights set to this layer, which should be a Tensor of size (inputDim, outputDim). Default is null and in this case weights are initialized by the initialization method specified by 'init'. Otherwise, 'weights' will override 'init' to take effect.

  49. val inputDim: Int

    Permalink

    Int > 0.

    Int > 0. Size of the vocabulary, ie. 1 + maximum integer index occurring in the input data. Each word index in the input should be within range [0, inputDim-1].

    Definition Classes
    Embedding → Embedding
  50. val inputShape: Shape

    Permalink

    A Single Shape, does not include the batch dimension.

    A Single Shape, does not include the batch dimension.

    Definition Classes
    Embedding
  51. def inputs(first: (ModuleNode[T], Int), nodesWithIndex: (ModuleNode[T], Int)*): ModuleNode[T]

    Permalink
    Definition Classes
    KerasLayer → AbstractModule
  52. def inputs(nodes: Array[ModuleNode[T]]): ModuleNode[T]

    Permalink
    Definition Classes
    KerasLayer → AbstractModule
  53. def inputs(nodes: ModuleNode[T]*): ModuleNode[T]

    Permalink
    Definition Classes
    KerasLayer → AbstractModule
  54. def isBuilt(): Boolean

    Permalink
    Definition Classes
    KerasLayer → InferShape
  55. def isFrozen[T]()(implicit arg0: ClassTag[T]): Boolean

    Permalink
    Definition Classes
    Net
  56. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  57. def isKerasStyle(): Boolean

    Permalink
    Definition Classes
    KerasLayer → InferShape
  58. final def isTraining(): Boolean

    Permalink
    Definition Classes
    AbstractModule
  59. def labor: AbstractModule[Tensor[T], Tensor[T], T]

    Permalink
    Definition Classes
    KerasLayer
  60. def labor_=(value: AbstractModule[Tensor[T], Tensor[T], T]): Unit

    Permalink
    Definition Classes
    KerasLayer
  61. var line: String

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  62. final def loadModelWeights(srcModel: Module[Float], matchAll: Boolean): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  63. final def loadWeights(weightPath: String, matchAll: Boolean): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  64. val modules: ArrayBuffer[AbstractModule[Activity, Activity, T]]

    Permalink
    Definition Classes
    Container
  65. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  68. var output: Tensor[T]

    Permalink
    Definition Classes
    AbstractModule
  69. val outputDim: Int

    Permalink

    Int > 0.

    Int > 0. Dimension of the dense embedding.

    Definition Classes
    Embedding → Embedding
  70. def parameters(): (Array[Tensor[T]], Array[Tensor[T]])

    Permalink
    Definition Classes
    Container → AbstractModule
  71. final def predict(dataset: RDD[Sample[T]], batchSize: Int, shareBuffer: Boolean): RDD[Activity]

    Permalink
    Definition Classes
    AbstractModule
  72. final def predictClass(dataset: RDD[Sample[T]], batchSize: Int): RDD[Int]

    Permalink
    Definition Classes
    AbstractModule
  73. final def predictImage(imageFrame: ImageFrame, outputLayer: String, shareBuffer: Boolean, batchPerPartition: Int, predictKey: String, featurePaddingParam: Option[PaddingParam[T]]): ImageFrame

    Permalink
    Definition Classes
    AbstractModule
  74. def processInputs(first: (ModuleNode[T], Int), nodesWithIndex: (ModuleNode[T], Int)*): ModuleNode[T]

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  75. def processInputs(nodes: Seq[ModuleNode[T]]): ModuleNode[T]

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  76. final def quantize(): Module[T]

    Permalink
    Definition Classes
    AbstractModule
  77. def release(): Unit

    Permalink
    Definition Classes
    Container → AbstractModule
  78. def reset(): Unit

    Permalink
    Definition Classes
    Container → AbstractModule
  79. def resetTimes(): Unit

    Permalink
    Definition Classes
    Container → AbstractModule
  80. final def saveCaffe(prototxtPath: String, modelPath: String, useV2: Boolean, overwrite: Boolean): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  81. final def saveDefinition(path: String, overWrite: Boolean): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  82. final def saveModule(path: String, weightPath: String, overWrite: Boolean): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  83. final def saveTF(inputs: Seq[(String, Seq[Int])], path: String, byteOrder: ByteOrder, dataFormat: TensorflowDataFormat): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  84. final def saveTorch(path: String, overWrite: Boolean): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  85. final def saveWeights(path: String, overWrite: Boolean): Unit

    Permalink
    Definition Classes
    AbstractModule
  86. var scaleB: Double

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  87. var scaleW: Double

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  88. final def setExtraParameter(extraParam: Array[Tensor[T]]): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  89. final def setLine(line: String): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  90. final def setName(name: String): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  91. def setScaleB(b: Double): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  92. def setScaleW(w: Double): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  93. final def setWeightsBias(newWeights: Array[Tensor[T]]): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
  94. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  95. def toGraph(startNodes: ModuleNode[T]*): Graph[T]

    Permalink
    Definition Classes
    AbstractModule
  96. def toString(): String

    Permalink
    Definition Classes
    AbstractModule → AnyRef → Any
  97. var train: Boolean

    Permalink
    Attributes
    protected
    Definition Classes
    AbstractModule
  98. val trainable: Boolean

    Permalink

    Whether this layer is trainable or not.

    Whether this layer is trainable or not. Default is true.

  99. final def training(): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  100. def unFreeze(names: String*): Embedding.this.type

    Permalink
    Definition Classes
    Container → AbstractModule
  101. def updateGradInput(input: Tensor[T], gradOutput: Tensor[T]): Tensor[T]

    Permalink
    Definition Classes
    KerasLayer → AbstractModule
  102. def updateOutput(input: Tensor[T]): Tensor[T]

    Permalink
    Definition Classes
    KerasLayer → AbstractModule
  103. var wRegularizer: Regularizer[T]

    Permalink

    An instance of Regularizer, (eg.

    An instance of Regularizer, (eg. L1 or L2 regularization), applied to the embedding matrix. Default is null.

    Definition Classes
    Embedding
  104. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  107. def zeroGradParameters(): Unit

    Permalink
    Definition Classes
    AbstractModule

Deprecated Value Members

  1. final def save(path: String, overWrite: Boolean): Embedding.this.type

    Permalink
    Definition Classes
    AbstractModule
    Annotations
    @deprecated
    Deprecated

    (Since version 0.3.0) please use recommended saveModule(path, overWrite)

Inherited from Net

Inherited from bigdl.nn.keras.Embedding[T]

Inherited from KerasLayer[Tensor[T], Tensor[T], T]

Inherited from Container[Tensor[T], Tensor[T], T]

Inherited from AbstractModule[Tensor[T], Tensor[T], T]

Inherited from InferShape

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped