Skip to content

Commit

Permalink
[build,src,doc] Modify get_version.sh to deal better with whitespace …
Browse files Browse the repository at this point in the history
…(avoid space in version); minor fixes (kaldi-asr#1526)
  • Loading branch information
danpovey authored and David Snyder committed Apr 12, 2017
1 parent c7edaec commit c1e7b29
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 93 deletions.
10 changes: 5 additions & 5 deletions src/base/get_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ elif [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" != true ]; then
echo "$0: Using the version number \"$version\" specified in src/.version."
else
# Figure out patch number.
version_commit=$(git log -1 --pretty=oneline ../.version | cut -f 1 -d ' ')
patch_number=$(git rev-list ${version_commit}..HEAD | wc -l)
version_commit=$(git log -1 --pretty=oneline ../.version | awk '{print $1}')
patch_number=$(git rev-list ${version_commit}..HEAD | wc -l | awk '{print $1}')
version="$version.$patch_number"

# Check for uncommitted changes in src/.
uncommitted_changes=$(git diff-index HEAD -- .. | wc -l)
uncommitted_changes=$(git diff-index HEAD -- .. | wc -l | awk '{print $1}')
if [ $uncommitted_changes -gt 0 ]; then
# Add suffix ~N if there are N files in src/ with uncommitted changes
version="$version~$uncommitted_changes"
fi

# Figure out HEAD commit SHA-1.
head_commit=$(git log -1 --pretty=oneline | cut -f 1 -d ' ')
head_commit_short=$(git log -1 --oneline --abbrev=4 | cut -f 1 -d ' ')
head_commit=$(git log -1 --pretty=oneline | awk '{print $1}')
head_commit_short=$(git log -1 --oneline --abbrev=4 | awk '{print $1}')
version="$version-${head_commit_short}"
fi

Expand Down
4 changes: 2 additions & 2 deletions src/chain/chain-training.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void ComputeChainObjfAndDeriv(const ChainTrainingOptions &opts,
const Supervision &supervision,
const CuMatrixBase<BaseFloat> &nnet_output,
BaseFloat *objf,
BaseFloat *l2_term,
BaseFloat *l2_term,
BaseFloat *weight,
CuMatrixBase<BaseFloat> *nnet_output_deriv,
CuMatrixBase<BaseFloat> *xent_output_deriv) {
Expand Down Expand Up @@ -86,7 +86,7 @@ void ComputeChainObjfAndDeriv(const ChainTrainingOptions &opts,
// for different frames of the sequences. As expected, they are
// smaller towards the edges of the sequences (due to the penalization
// of 'incorrect' pdf-ids.
if (GetVerboseLevel() >= 1) {
if (GetVerboseLevel() >= 1 && nnet_output_deriv != NULL) {
int32 tot_frames = nnet_output_deriv->NumRows(),
frames_per_sequence = supervision.frames_per_sequence,
num_sequences = supervision.num_sequences;
Expand Down
Loading

0 comments on commit c1e7b29

Please sign in to comment.