include/tenzr/txpr/custom_op_deriv.h
Namespaces
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_TXPR_CUSTOM_OP_DERIV_H_
#define TENZR_TXPR_CUSTOM_OP_DERIV_H_
#include <string_view>
#include <vector>
#include "tenzr/frontend/array.h"
namespace tenzr::txpr {
[[nodiscard]] bool IsZeroDerivativeCustomOp(std::string_view op);
[[nodiscard]] bool HasDerivativeRule(std::string_view op);
[[nodiscard]] bool HasJvpRule(std::string_view op);
void CustomOpVjp(std::string_view op, const std::vector<Array>& inputs, const Array& grad_out, std::vector<Array>& out);
Array CustomOpJvp(std::string_view op, const std::vector<Array>& primals, const std::vector<Array>& tangents);
} // namespace tenzr::txpr
#endif // TENZR_TXPR_CUSTOM_OP_DERIV_H_