forked from emer/emergent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples/bench for benchmarking -- not scaling well at larger sizes r…
…elative to C++, but getting some threading advantages. added patgen lib, permute util funcs, timer package, and first-pass layer-level threading.
- Loading branch information
Randall C. O'Reilly
committed
Feb 3, 2019
1 parent
033d04f
commit 36030eb
Showing
19 changed files
with
725 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) 2019, The Emergent Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// Package erand provides randomization functionality built on top of standard math/rand | ||
// random number generation functions. Includes: | ||
// * RndParams: specifies parameters for random number generation according to various distributions | ||
// used e.g., for initializing random weights and generating random noise in neurons | ||
// * Permute*: basic convenience methods calling rand.Shuffle on e.g., []int slice | ||
// | ||
package erand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) 2019, The Emergent Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package erand | ||
|
||
import "math/rand" | ||
|
||
// PermuteInts permutes (shuffles) the order of elements in the given int slice | ||
// using the standard Fisher-Yates shuffle | ||
// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | ||
// So you don't have to remember how to call rand.Shuffle | ||
func PermuteInts(is []int) { | ||
rand.Shuffle(len(is), func(i, j int) { | ||
is[i], is[j] = is[j], is[i] | ||
}) | ||
} | ||
|
||
// PermuteStrings permutes (shuffles) the order of elements in the given string slice | ||
// using the standard Fisher-Yates shuffle | ||
// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | ||
// So you don't have to remember how to call rand.Shuffle | ||
func PermuteStrings(is []string) { | ||
rand.Shuffle(len(is), func(i, j int) { | ||
is[i], is[j] = is[j], is[i] | ||
}) | ||
} | ||
|
||
// PermuteFloat32s permutes (shuffles) the order of elements in the given float32 slice | ||
// using the standard Fisher-Yates shuffle | ||
// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | ||
// So you don't have to remember how to call rand.Shuffle | ||
func Permutefloat32s(is []float32) { | ||
rand.Shuffle(len(is), func(i, j int) { | ||
is[i], is[j] = is[j], is[i] | ||
}) | ||
} | ||
|
||
// PermuteFloat64s permutes (shuffles) the order of elements in the given float64 slice | ||
// using the standard Fisher-Yates shuffle | ||
// https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle | ||
// So you don't have to remember how to call rand.Shuffle | ||
func Permutefloat64s(is []float64) { | ||
rand.Shuffle(len(is), func(i, j int) { | ||
is[i], is[j] = is[j], is[i] | ||
}) | ||
} |
Binary file not shown.
Oops, something went wrong.