Skip to content

include/tenzr/debug/debug.h

Namespaces

Name
tenzr
tenzr::debug

Source code

// Copyright 2026 The Tenzr Project Authors
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef TENZR_DEBUG_DEBUG_H_
#define TENZR_DEBUG_DEBUG_H_

#include <iostream>
#include <sstream>
#include <string>
#include <string_view>
#include <vector>

#include "tenzr/frontend/array.h"
#include "tenzr/txpr/txpr.h"

namespace tenzr::debug {

  void Print(std::string_view label, const Array& x, bool print_data = true, std::ostream& os = std::cout);

  void CheckFinite(const Array& x, std::string_view op_context = "");

  [[nodiscard]] std::string Inspect(const Array& x);

  [[nodiscard]] std::string FormatTxpr(const txpr::Txpr& txpr);

  void DumpTxpr(const txpr::Txpr& txpr, std::ostream& os = std::cout);

  [[nodiscard]] std::string FormatStablehlo(const txpr::Txpr& txpr);

  void DumpStablehlo(const txpr::Txpr& txpr, std::ostream& os = std::cout);

}  // namespace tenzr::debug

#endif  // TENZR_DEBUG_DEBUG_H_