@tensorify.io/sdk
Version:
TypeScript SDK for developing Tensorify plugins with V2-Alpha definition/execution pattern and legacy compatibility
47 lines • 1.5 kB
TypeScript
import { BasePlugin } from "./base-plugin";
import { GenerateCodeContext } from "./v2-alpha-types";
/**
* Base class for machine learning plugins
*
* Provides common functionality for ML/AI workflow nodes like
* device management, tensor operations, and common imports.
*/
export declare abstract class MLPlugin extends BasePlugin {
/**
* Get common PyTorch imports
*/
protected getCommonImports(): string[];
/**
* Generate device setup code
*/
protected generateDeviceSetup(): string;
/**
* Helper to move a variable to device
*/
protected moveToDevice(varName: string): string;
/**
* Get settings with type safety
*/
protected getSettings<T extends Record<string, any>>(ctx: GenerateCodeContext): T;
/**
* Format Python code with proper indentation
*/
protected formatCode(code: string, indent?: number): string;
/**
* Combine imports from multiple sources and deduplicate
*/
protected mergeImports(...importLists: string[][]): string[];
/**
* Generate a Python function definition
*/
protected generateFunction(name: string, params: string[], body: string, returnType?: string): string;
/**
* Generate a Python class definition
*/
protected generateClass(name: string, baseClass: string, methods: {
name: string;
params: string[];
body: string;
}[], initBody?: string): string;
}
//# sourceMappingURL=ml-plugin.d.ts.map