"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.argmax = exports.min = exports.max = exports.mean = exports.sum = exports.tanh = exports.square = exports.round = exports.floor = exports.ceil = exports.atan = exports.asin = exports.acos = exports.neg = exports.tan = exports.sin = exports.cos = exports.abs = exports.sqrt = exports.log = exports.exp = exports.sigmoid = exports.relu = exports.dot = exports.matmul = exports.div = exports.mul = exports.sub = exports.add = exports.ops = exports.Sigmoid = exports.Dropout = exports.Flatten = exports.Sequential = exports.Linear = exports.optimizers = exports.nn = exports.ReLU = exports.BatchNorm1d = exports.Conv1d = exports.Lbfgs = exports.Lamb = exports.Adagrad = exports.RmSprop = exports.AdamW = exports.Adam = exports.Sgd = exports.version = exports.Tensor = exports.NumRsArray = void 0;
exports.Dataset = exports.TrainerBuilder = exports.SGD = exports.concat = exports.broadcastTo = exports.transpose = exports.flatten = exports.reshape = exports.norm = exports.crossEntropy = exports.softmax = exports.variance = void 0;
const path_1 = __importDefault(require("path"));
const fs_1 = __importDefault(require("fs"));
// --- Load Native Binary ---
const binaryName = 'numrs_node.node';
const rootPath = path_1.default.join(__dirname, '..', binaryName);
const releasePath = path_1.default.join(__dirname, '../target/release', binaryName);
const debugPath = path_1.default.join(__dirname, '../target/debug', binaryName);
let nativeBinding;
if (fs_1.default.existsSync(rootPath)) {
    nativeBinding = require(rootPath);
}
else if (fs_1.default.existsSync(releasePath)) {
    nativeBinding = require(releasePath);
}
else if (fs_1.default.existsSync(debugPath)) {
    nativeBinding = require(debugPath);
}
else {
    throw new Error(`Could not find native binary at ${rootPath}, ${releasePath} or ${debugPath}`);
}
// --- Grouped Exports ---
exports.NumRsArray = nativeBinding.NumRsArray, exports.Tensor = nativeBinding.Tensor, exports.version = nativeBinding.version, 
// Extract raw optimizers
exports.Sgd = nativeBinding.Sgd, exports.Adam = nativeBinding.Adam, exports.AdamW = nativeBinding.AdamW, exports.RmSprop = nativeBinding.RmSprop, exports.Adagrad = nativeBinding.Adagrad, exports.Lamb = nativeBinding.Lamb, exports.Lbfgs = nativeBinding.Lbfgs, exports.Conv1d = nativeBinding.Conv1D, exports.BatchNorm1d = nativeBinding.BatchNorm1D, exports.ReLU // Map ReLu -> ReLU
 = nativeBinding.ReLu;
exports.nn = {
    Linear: nativeBinding.Linear,
    Sequential: nativeBinding.Sequential,
    ReLU: exports.ReLU,
    Sigmoid: nativeBinding.Sigmoid,
    Conv1d: exports.Conv1d,
    Flatten: nativeBinding.Flatten,
    Dropout: nativeBinding.Dropout,
    BatchNorm1d: exports.BatchNorm1d
};
exports.optimizers = {
    SGD: exports.Sgd,
    Adam: exports.Adam,
    AdamW: exports.AdamW,
    RMSprop: exports.RmSprop,
    Adagrad: exports.Adagrad,
    LAMB: exports.Lamb,
    LBFGS: exports.Lbfgs
};
// Re-export constants for easy access
exports.Linear = nativeBinding.Linear;
exports.Sequential = nativeBinding.Sequential;
exports.Flatten = nativeBinding.Flatten;
exports.Dropout = nativeBinding.Dropout;
exports.Sigmoid = nativeBinding.Sigmoid;
exports.ops = {
    add: nativeBinding.add,
    sub: nativeBinding.sub,
    mul: nativeBinding.mul,
    div: nativeBinding.div,
    matmul: nativeBinding.matmul,
    dot: nativeBinding.dot,
    // Unary
    relu: nativeBinding.relu,
    sigmoid: nativeBinding.sigmoid,
    exp: nativeBinding.exp,
    log: nativeBinding.log,
    sqrt: nativeBinding.sqrt,
    abs: nativeBinding.abs,
    cos: nativeBinding.cos,
    sin: nativeBinding.sin,
    tan: nativeBinding.tan,
    neg: nativeBinding.neg,
    acos: nativeBinding.acos,
    asin: nativeBinding.asin,
    atan: nativeBinding.atan,
    ceil: nativeBinding.ceil,
    floor: nativeBinding.floor,
    round: nativeBinding.round,
    square: nativeBinding.square,
    tanh: nativeBinding.tanh,
    // Reduction
    sum: nativeBinding.sum,
    mean: nativeBinding.mean,
    max: nativeBinding.max,
    min: nativeBinding.min,
    argmax: nativeBinding.argmax,
    variance: nativeBinding.variance,
    // Stats
    softmax: nativeBinding.softmax,
    crossEntropy: nativeBinding.crossEntropy,
    norm: nativeBinding.norm,
    // Shape
    reshape: nativeBinding.reshape,
    flatten: nativeBinding.flatten,
    transpose: nativeBinding.transpose,
    broadcastTo: nativeBinding.broadcastTo,
    concat: nativeBinding.concat,
};
// Re-export individually for legacy compatibility (and ts/ops/index.ts support)
exports.add = nativeBinding.add;
exports.sub = nativeBinding.sub;
exports.mul = nativeBinding.mul;
exports.div = nativeBinding.div;
exports.matmul = nativeBinding.matmul;
exports.dot = nativeBinding.dot;
exports.relu = nativeBinding.relu;
exports.sigmoid = nativeBinding.sigmoid;
exports.exp = nativeBinding.exp;
exports.log = nativeBinding.log;
exports.sqrt = nativeBinding.sqrt;
exports.abs = nativeBinding.abs;
exports.cos = nativeBinding.cos;
exports.sin = nativeBinding.sin;
exports.tan = nativeBinding.tan;
exports.neg = nativeBinding.neg;
exports.acos = nativeBinding.acos;
exports.asin = nativeBinding.asin;
exports.atan = nativeBinding.atan;
exports.ceil = nativeBinding.ceil;
exports.floor = nativeBinding.floor;
exports.round = nativeBinding.round;
exports.square = nativeBinding.square;
exports.tanh = nativeBinding.tanh;
exports.sum = nativeBinding.sum;
exports.mean = nativeBinding.mean;
exports.max = nativeBinding.max;
exports.min = nativeBinding.min;
exports.argmax = nativeBinding.argmax;
exports.variance = nativeBinding.variance;
exports.softmax = nativeBinding.softmax;
exports.crossEntropy = nativeBinding.crossEntropy;
exports.norm = nativeBinding.norm;
exports.reshape = nativeBinding.reshape;
exports.flatten = nativeBinding.flatten;
exports.transpose = nativeBinding.transpose;
exports.broadcastTo = nativeBinding.broadcastTo;
exports.concat = nativeBinding.concat;
// Conv1d, BatchNorm1d, ReLU are already exported via destructuring above
// But wait, are they?
// Step 4803 replacent used `Conv1D: Conv1d` inside `export const { ... }`.
// So `Conv1d` IS exported.
// So I should remove the redundant exports here.
// Re-export optimizers (legacy name access if needed, favoring grouped)
// Re-export optimizers (legacy name access if needed, favoring grouped)
exports.SGD = exports.Sgd;
// Export Trainer classes
exports.TrainerBuilder = nativeBinding.TrainerBuilder;
exports.Dataset = nativeBinding.Dataset;
//# sourceMappingURL=native_loader.js.map