Skip to content

Commit 38dc958

Browse files
committed
Remove an unneeded conversion
1 parent 74d0ba3 commit 38dc958

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

src/edu/stanford/nlp/coref/fastneural/FastNeuralCorefAlgorithm.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ public FastNeuralCorefAlgorithm(Properties props, Dictionaries dictionaries) {
5050
maxMentionDistanceWithStringMatch = CorefProperties.maxMentionDistanceWithStringMatch(props);
5151
featureExtractor = new FeatureExtractor(props, dictionaries, null,
5252
StatisticalCorefProperties.wordCountsPath(props));
53-
FastNeuralCorefModel loadedModel = IOUtils.readObjectAnnouncingTimingFromURLOrClasspathOrFileSystem(
53+
model = IOUtils.readObjectAnnouncingTimingFromURLOrClasspathOrFileSystem(
5454
log, "Loading coref model...", FastNeuralCorefProperties.modelPath(props));
55-
model = loadedModel.getCopyWithNewWeights(); // TODO: remove when ejml upgraded
5655
}
5756

5857
@Override

src/edu/stanford/nlp/coref/fastneural/FastNeuralCorefModel.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import java.util.HashMap;
77
import java.util.List;
88
import java.util.Map;
9-
import java.util.stream.Collectors;
109

1110
import edu.stanford.nlp.coref.data.Mention;
1211
import edu.stanford.nlp.coref.neural.CategoricalFeatureExtractor;
@@ -145,26 +144,6 @@ private SimpleMatrix addDistanceFeatures(SimpleMatrix featureVector,
145144
);
146145
}
147146

148-
// TODO: remove when ejml is upgraded
149-
public FastNeuralCorefModel getCopyWithNewWeights() {
150-
List<SimpleMatrix> weights = new ArrayList<>();
151-
weights.add(new SimpleMatrix(anaphorKernel));
152-
weights.add(new SimpleMatrix(anaphorBias));
153-
weights.add(new SimpleMatrix(antecedentKernel));
154-
weights.add(new SimpleMatrix(anaphorBias));
155-
weights.add(new SimpleMatrix(pairFeaturesKernel));
156-
weights.add(new SimpleMatrix(pairFeaturesBias));
157-
weights.add(new SimpleMatrix(NARepresentation));
158-
weights.addAll(networkLayers.stream()
159-
.map(x->new SimpleMatrix(x))
160-
.collect(Collectors.toList()));
161-
return new FastNeuralCorefModel(
162-
embeddingExtractor,
163-
pairFeatureIds,
164-
mentionFeatureIds,
165-
weights);
166-
}
167-
168147
public static FastNeuralCorefModel loadFromTextFiles(String path) {
169148
List<SimpleMatrix> weights = NeuralUtils.loadTextMatrices(path + "weights.txt");
170149
weights.set(weights.size() - 2, weights.get(weights.size() - 2).transpose());

0 commit comments

Comments
 (0)