-
Notifications
You must be signed in to change notification settings - Fork 161
Closed
Description
The implementations of describeExtra of Linear and Embedding depend directly on weight for shape descriptions, resulting in incorrect shape descriptions for their quantized versions.
open class Embedding {
public override func describeExtra(_ indent: Int) -> String {
weight.shape.description
}
}
open class Linear {
open override func describeExtra(_ indent: Int) -> String {
"(inputDimensions=\(weight.dim(1)), outputDimensions=\(weight.dim(0)), bias=\(bias == nil ? "false" : "true"))"
}
}For Linear and its subclasses, it can be easily fixed by:
open class Linear {
open override func describeExtra(_ indent: Int) -> String {
let (outputDimensions, inputDimensions) = self.shape
return "(inputDimensions=\(inputDimensions), outputDimensions=\(outputDimensions), bias=\(bias == nil ? "false" : "true"))"
}
}For Embedding, we should introduce shape as in Linear. Besides, the access control modifier of describeExtra should be widened to open.
open class Embedding {
open var shape: (Int, Int) {
self.weight.shape2
}
open override func describeExtra(_ indent: Int) -> String {
self.shape.description
}
}
open class QuantizedEmbedding {
open override var shape: (Int, Int) {
let (embeddingCount, dimensions) = self.shape
return (embeddingCount, dimensions * 32 / self.bits)
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels