Skip to content

Commit 2603b7a

Browse files
committed
Remove redundant type conversions
1 parent eeab0e3 commit 2603b7a

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

cmd/huggingfaceimporter/internal/interactive.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"fmt"
99
"github.com/lithammer/fuzzysearch/fuzzy"
1010
"github.com/manifoldco/promptui"
11-
"github.com/manifoldco/promptui/list"
1211
"os"
1312
"path"
1413
)
@@ -85,9 +84,9 @@ func (a *ImporterArgs) ConfigureInteractive(repo string) error {
8584
Items: ids,
8685
// Called on each items of the select and should return a
8786
// boolean for whether or not the item fits the searched term.
88-
Searcher: list.Searcher(func(input string, index int) bool {
87+
Searcher: func(input string, index int) bool {
8988
return fuzzy.Match(input, ids[index])
90-
}),
89+
},
9190
}).Run()
9291
if err != nil {
9392
return err

pkg/mat32/internal/asm/f32/ge_noasm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func Ger(m, n uintptr, alpha float32, x []float32, incX uintptr, y []float32, in
3131

3232
ix := kx
3333
for i := 0; i < int(m); i++ {
34-
AxpyInc(alpha*x[ix], y, a[uintptr(i)*lda:uintptr(i)*lda+n], uintptr(n), uintptr(incY), 1, uintptr(ky), 0)
34+
AxpyInc(alpha*x[ix], y, a[uintptr(i)*lda:uintptr(i)*lda+n], n, incY, 1, ky, 0)
3535
ix += incX
3636
}
3737
}

pkg/mat32/internal/math32/const.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ const (
1212
SqrtPhi = float32(1.27201964951406896425242246173749149171560804184009624861664038) // http://oeis.org/A139339
1313

1414
Ln2 = float32(0.693147180559945309417232121458176568075500134360255254120680009) // http://oeis.org/A002162
15-
Log2E = float32(1 / Ln2)
15+
Log2E = 1 / Ln2
1616
Ln10 = float32(2.30258509299404568401799145468436420760110148862877297603332790) // http://oeis.org/A002392
17-
Log10E = float32(1 / Ln10)
17+
Log10E = 1 / Ln10
1818
)
1919

2020
// Floating-point limit values.

pkg/mat64/internal/asm/f64/benchAxpy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func BenchmarkAxpyInc(t *testing.B) {
120120
idx = uintptr((-int(tt.len) + 1) * inc)
121121
}
122122
for i := 0; i < b.N; i++ {
123-
test.f(a, x, y, uintptr(tt.len), tstInc, tstInc, idx, idx)
123+
test.f(a, x, y, tt.len, tstInc, tstInc, idx, idx)
124124
}
125125
})
126126
}
@@ -154,7 +154,7 @@ func BenchmarkAxpyIncTo(t *testing.B) {
154154
idx = uintptr((-int(tt.len) + 1) * inc)
155155
}
156156
for i := 0; i < b.N; i++ {
157-
test.f(z, tstInc, idx, a, x, y, uintptr(tt.len),
157+
test.f(z, tstInc, idx, a, x, y, tt.len,
158158
tstInc, tstInc, idx, idx)
159159
}
160160
})

pkg/mat64/internal/asm/f64/benchScal_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func BenchmarkScalInc(t *testing.B) {
6363
b.SetBytes(int64(64 * tt.len))
6464
tstInc := uintptr(inc)
6565
for i := 0; i < b.N; i++ {
66-
ScalInc(a, x, uintptr(tt.len), tstInc)
66+
ScalInc(a, x, tt.len, tstInc)
6767
}
6868
})
6969
}
@@ -78,7 +78,7 @@ func BenchmarkScalIncTo(t *testing.B) {
7878
b.SetBytes(int64(64 * tt.len))
7979
tstInc := uintptr(inc)
8080
for i := 0; i < b.N; i++ {
81-
ScalIncTo(z, tstInc, a, x, uintptr(tt.len), tstInc)
81+
ScalIncTo(z, tstInc, a, x, tt.len, tstInc)
8282
}
8383
})
8484
}

pkg/ml/ag/graph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ func (g *Graph) IncTimeStep() {
506506
// to perform truncated back propagation. This value is 0 for a new Graph, and
507507
// can be incremented calling IncTimeStep.
508508
func (g *Graph) TimeStep() int {
509-
return int(g.curTimeStep)
509+
return g.curTimeStep
510510
}
511511

512512
// Nodes returns the nodes of the graph.

pkg/ml/optimizers/gd/decay/exponential/exponential.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func New(init, final mat.Float, iter int) *Exponential {
3131
// Decay calculates the decay of the learning rate lr at time t.
3232
func (d *Exponential) Decay(lr mat.Float, t int) mat.Float {
3333
if t > 1 && lr > d.final {
34-
return mat.Exp((mat.Float(d.times-t)*mat.Log(lr) + mat.Log(mat.Float(d.final))) / mat.Float(d.times-t+1))
34+
return mat.Exp((mat.Float(d.times-t)*mat.Log(lr) + mat.Log(d.final)) / mat.Float(d.times-t+1))
3535
}
3636
return lr
3737
}

0 commit comments

Comments
 (0)