private final TIntObjectHashMap<Expression> cachedSubstitutions = new TIntObjectHashMap<>();
private Tensor traceWithout5(Tensor tensor, int numberOfGammas) {
Expression substitution = cachedSubstitutions.get(numberOfGammas);
if (substitution == null) {
ParseToken rawSubstitution = createRawGammaSubstitution(numberOfGammas);
substitution = (Expression) tokenTransformer.transform(rawSubstitution).toTensor();
cachedSubstitutions.put(numberOfGammas, substitution);
}
tensor = substitution.transform(tensor);