public synchronized EmbeddingProjection addEmbedding(final Embedding embedding) {
        final var projection = EmbeddingProjection.from(embedding);

        final INDArray array = Nd4j.create(new double[][]{embedding.getEmbedding()});

        embeddings = embeddings.isEmpty()
                ? array
                : Nd4j.concat(0, embeddings, array);

        projection2Index.put(
                projection,
                getSize() - 1
        );

        return projection;
    }
NOTE: current method returns COPY! Each time you invoke it, memory consumed, be careful!

@return copy of underlying embeddings array.
java/api/src/main/java/com/exadel/frs/core/trainservice/cache/EmbeddingCollection.java