kaldi-asr / kaldi-asr/kaldi

Couple questions RE tensor stuff

Open
#3,263 5 comments 0 reactions 0 assignees View on GitHub
discussion stale
Dominant language
Shell
Stars
15.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

I have a couple of questions RE the Tensor stuff I'm working on for kaldi10.

It wasn't really possible to avoid the use of shared_ptr (although if we don't need
multi-threaded operation, we could of course always replace them later with something
that doesn't use atomics).

When I write code involving passing shared_ptr around, sometimes I do
```
void Foo (const std::shared_ptr &bar);
```
with the logic that passing a const reference to the shared_ptr should be much faster than
copying the shared_ptr (which would involve changing its ref-count, hence atomics).
Is this reasonable? @kkm000? It just looks odd to me.

Secondly, I want to augment Variable with a mechanism to (optionally) store
arbitrary configuration information. It's in case we need any of those types of
mechanisms we use in Kaldi, where, for instance, we set different amounts of
l2 on different parameters, or specify an orthonormal constraint for certain
parameters, etc. (Parameter groups, like PyTorch uses, are
super-inconvenient and also don't really scale beyond a single configurable
parameter). One possibility is a map from string to string, but it seems wrong to
have to parse strings anytime you need a configuration variable. Another
possibility is to map from string to some kind of struct that can store a bool,
an int or a string (for instance; could maybe be augmented later). Of course
we'd have to figure out how to reflect this to Python, but it should be fairly easy
since it's pretty much in the spirit of how Python works. I just wondered whether
anyone has any comments, and whether there is a standard way to do this?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.