Skip to content

Commit

Permalink
AddScaler -> AddScalar
Browse files Browse the repository at this point in the history
  • Loading branch information
unixpickle committed Apr 14, 2017
1 parent 8d96613 commit 8f28fdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions experiments/omniglot/model.go
Expand Up @@ -94,13 +94,13 @@ func normInputLayer(c anyvec.Creator, numOut, numPixels int) anyrnn.Block {
Scalers: anydiff.NewVar(c.MakeVector(numPixels + numOut)),
Biases: anydiff.NewVar(c.MakeVector(numPixels + numOut)),
}
affine.Scalers.Vector.AddScaler(c.MakeNumeric(4))
affine.Scalers.Vector.AddScalar(c.MakeNumeric(4))

modified := affine.Scalers.Vector.Slice(numPixels, numPixels+numOut)
modified.Scale(c.MakeNumeric(4))

modified = affine.Biases.Vector.Slice(0, numPixels)
modified.AddScaler(c.MakeNumeric(-4 * 0.92))
modified.AddScalar(c.MakeNumeric(-4 * 0.92))

return &anyrnn.LayerBlock{Layer: affine}
}
4 changes: 2 additions & 2 deletions net_test.go
Expand Up @@ -43,7 +43,7 @@ func TestNetTrain(t *testing.T) {
target := anydiff.NewVar(targetVec)

stepSize := c.MakeVector(1)
stepSize.AddScaler(c.MakeNumeric(0.1))
stepSize.AddScalar(c.MakeNumeric(0.1))

trained := virtualNet.Train(input, target, anydiff.NewConst(stepSize), 4, 2)
actual := trained.Parameters.Outputs()
Expand Down Expand Up @@ -136,7 +136,7 @@ func BenchmarkNetwork(b *testing.B) {
anyvec.Rand(target.Vector, anyvec.Normal, nil)

stepSize := anydiff.NewConst(c.MakeVector(1))
stepSize.Vector.AddScaler(float32(0.1))
stepSize.Vector.AddScalar(float32(0.1))

b.Run("Forward", func(b *testing.B) {
for i := 0; i < b.N; i++ {
Expand Down

0 comments on commit 8f28fdc

Please sign in to comment.