public void vectorToParams(double[] theta) { NeuralUtils.vectorToParams( theta, binaryTransform.valueIterator(), binaryClassification.valueIterator(), SimpleTensor.iteratorSimpleMatrix(binaryTensors.valueIterator()), unaryClassification.values().iterator(), wordVectors.values().iterator()); }
public double[] paramsToVector() { int totalSize = totalParamSize(); return NeuralUtils.paramsToVector( totalSize, binaryTransform.valueIterator(), binaryClassification.valueIterator(), SimpleTensor.iteratorSimpleMatrix(binaryTensors.valueIterator()), unaryClassification.values().iterator(), wordVectors.values().iterator()); }
SimpleTensor randomBinaryTensor() { double range = 1.0 / (4.0 * numHid); SimpleTensor tensor = SimpleTensor.random(numHid * 2, numHid * 2, numHid, -range, range, rand); return tensor.scale(op.trainOptions.scalingForInit); }