Examples of useSharedWeights()


Examples of com.github.neuralnetworks.architecture.ConnectionFactory.useSharedWeights()

  Map<Connections, Tensor> result = new HashMap<>();

  ConnectionFactory cf = nn.getProperties().getParameter(Constants.CONNECTION_FACTORY);

  List<Connections> connections = cf.getConnections().stream().filter(c -> c instanceof WeightsConnections).collect(Collectors.toList());
  float[] elements = cf.useSharedWeights() ? new float[((WeightsConnections) connections.get(0)).getWeights().getElements().length] : null;
  IntStream.range(0, connections.size()).forEach(i -> result.put(connections.get(i), TensorFactory.duplicate(((WeightsConnections) connections.get(i)).getWeights(), elements)));

  return result;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.