Skip to content

Instantly share code, notes, and snippets.

@Moddus
Moddus / go_routines_with_chan.go
Last active August 29, 2015 14:20
Just some golang snipptes
package main
import (
"log"
)
func main() {
c := make(chan string)
for i := 0; i < 10; i++ {
go func(i int, c chan string) {
using adaptive_systeme
data = [[1 0 0],[1 0 1], [1 1 0], [1 1 1]]
result_OR = [0; 1; 1; 1]
result_AND = [0; 0; 0; 1]
result_XOR = [0; 1; 1; 0]
p = Perzeptron(.5, .1, result_OR, 1000, lineare)
training(p, data)
import numpy as np
class Perzeptron:
def __init__(self, t, my, d, maxiter, sign):
self.t = t
self.my = my
self.maxiter = maxiter
self.sign = sign
self.w = np.mat([[-self.t],[1],[1]])
public static File getFile(String name) {
URL url = Thread.currentThread().getContextClassLoader().getResource(name.replace(File.separatorChar, '/'));
if(url != null) {
try {
return new File(url.toURI());
} catch (Exception var3) {
throw new RuntimeException("Resource was found on classpath, but cannot be resolved to a normal file (maybe it is part of a JAR file): " + name);
}
} else {
File file = new File(name);
@Moddus
Moddus / BlasWrapper.java
Created February 12, 2016 12:18
deeplearning4j load openblas
public class BlasWrapper extends BaseBlasWrapper {
private static final Logger log = LoggerFactory.getLogger(BlasWrapper.class);
public final static String FORCE_NATIVE = "org.nd4j.linalg.cpu.force_native";
static {
// System property toggle hasSetNative var
// if the property isn't set the warning is allways displayed.
String forceNative = System.getProperty(FORCE_NATIVE,"false");
boolean hasSetNative = false;