  return mode_;
}

void TensorCtx::fixKey(int key) {
  if (keyFixed()) throw std::runtime_error("TensorCtx key is fixed");
  key_ = key;
}

void TensorCtx::unfixKey() {
  key_ = -1;
}

bool TensorCtx::keyFixed() const {
  return key_ != -1;
}