export enum LayerType { INPUT = 'Input', LINEAR = 'Linear', CONV1D = 'Conv1D', CONV2D = 'Conv2D', CONV3D = 'Conv3D', CONV_TRANSPOSE2D = 'ConvTranspose2D', DEFORMABLE_CONV = 'DeformConv2d', SEPARABLE_CONV2D = 'SeparableConv2D', // New DEPTHWISE_CONV2D = 'DepthwiseConv2D', // New RELU = 'ReLU', LEAKYRELU = 'LeakyReLU', PRELU = 'PReLU', GELU = 'GELU', SILU = 'SiLU', SWIGLU = 'SwiGLU', SIGMOID = 'Sigmoid', TANH = 'Tanh', SOFTPLUS = 'Softplus', // New SOFTSIGN = 'Softsign', // New MAXPOOL = 'MaxPool2D', MAXPOOL3D = 'MaxPool3D', AVGPOOL = 'AvgPool2D', GLOBAL_AVG_POOL = 'GlobalAvgPool', ADAPTIVEAVGPOOL = 'AdaptiveAvgPool2D', UPSAMPLE = 'Upsample', PIXEL_SHUFFLE = 'PixelShuffle', DROPOUT = 'Dropout', DROPPATH = 'DropPath', SPATIAL_DROPOUT = 'SpatialDropout', // New BATCHNORM = 'BatchNorm2D', GROUPNORM = 'GroupNorm', LAYERNORM = 'LayerNorm', RMSNORM = 'RMSNorm', INSTANCENORM = 'InstanceNorm2d', FLATTEN = 'Flatten', RESHAPE = 'Reshape', PERMUTE = 'Permute', UNFLATTEN = 'Unflatten', EMBEDDING = 'Embedding', PATCH_EMBED = 'PatchEmbed', POS_EMBED = 'PositionalEmbed', ROPE = 'RotaryPosEmbed', TIME_EMBEDDING = 'TimeEmbedding', LSTM = 'LSTM', GRU = 'GRU', ATTENTION = 'SelfAttention', CROSS_ATTENTION = 'CrossAttention', WINDOW_ATTENTION = 'WindowAttention', TRANSFORMER_BLOCK = 'TransformerBlock', TRANSFORMER_ENCODER = 'TransformerEncoderLayer', TRANSFORMER_DECODER = 'TransformerDecoderLayer', MOE_BLOCK = 'SparseMoEBlock', SE_BLOCK = 'SqueezeExcitation', ACTION_HEAD = 'ActionHead', SAM_PROMPT_ENCODER = 'SamPromptEncoder', SAM_MASK_DECODER = 'SamMaskDecoder', // TensorFlow / Keras Preprocessing RESCALING = 'Rescaling', RESIZING = 'Resizing', CENTER_CROP = 'CenterCrop', RANDOM_FLIP = 'RandomFlip', RANDOM_ROTATION = 'RandomRotation', RANDOM_ZOOM = 'RandomZoom', RANDOM_CONTRAST = 'RandomContrast', TEXT_VECTORIZATION = 'TextVectorization', NORMALIZATION_LAYER = 'NormalizationLayer', // Keras style mean/var DISCRETIZATION = 'Discretization', CATEGORY_ENCODING = 'CategoryEncoding', // YOLO / Detection C2F_BLOCK = 'C2fBlock', SPPF_BLOCK = 'SPPFBlock', DARKNET_BLOCK = 'DarknetBlock', DETECT_HEAD = 'DetectHead', ANCHOR_BOX = 'AnchorBox', NMS = 'NMS', // Audio / Speech STFT = 'STFT', MEL_SPECTROGRAM = 'MelSpectrogram', SPEC_AUGMENT = 'SpecAugment', CONFORMER_BLOCK = 'ConformerBlock', WAVENET_BLOCK = 'WaveNetBlock', WAV2VEC2_ENC = 'Wav2Vec2Encoder', RVC_ENCODER = 'HubertContentEncoder', VOCODER = 'Vocoder', AUDIO_EMBEDDING = 'AudioEmbedding', SINC_CONV = 'SincConv', // 3D / NeRF / Point Cloud NERF_BLOCK = 'NeRFBlock', POINTNET_BLOCK = 'PointNetBlock', POINT_TRANSFORMER = 'PointTransformer', TRIPLANE_ENC = 'TriplaneEncoder', GAUSSIAN_SPLAT = 'GaussianSplatDecoder', MESH_CONV = 'MeshConv', // OCR (Text Recognition) TPS_TRANSFORM = 'TPSTransform', CRNN_BLOCK = 'CRNNBlock', CTC_DECODER = 'CTCDecoder', // Depth / Motion / Robotics DEPTH_DECODER = 'DepthDecoder', DISPARITY_HEAD = 'DisparityHead', OPTICAL_FLOW = 'OpticalFlowBlock', VELOCITY_HEAD = 'VelocityHead', KALMAN_FILTER = 'KalmanFilter', BEV_TRANSFORM = 'BEVTransformer', RADAR_ENCODER = 'RadarEncoder', // Video / Generation VIDEO_DIFFUSION_BLOCK = 'VideoDiffusionBlock', SPATIO_TEMPORAL_ATTN = 'SpatioTemporalAttention', VIDEO_TOKENIZER = 'VideoTokenizer', FRAME_INTERPOLATOR = 'FrameInterpolator', TEMPORAL_SHIFT = 'TemporalShift', NON_LOCAL_BLOCK = 'NonLocalBlock', MULTIMODAL_FUSION = 'MultimodalFusion', // Graph Neural Networks (GNN) GCN_CONV = 'GCNConv', GRAPH_SAGE = 'GraphSAGE', GAT_CONV = 'GATConv', GIN_CONV = 'GINConv', // Physics & SciML NEURAL_ODE = 'NeuralODE', PINN_LINEAR = 'PINNLinear', HAMILTONIAN_NN = 'HamiltonianNN', PROTEIN_FOLDING = 'ProteinFoldingBlock', // Spiking & Neuromorphic LIF_NEURON = 'LIFNeuron', SPIKING_LAYER = 'SpikingLayer', // Reinforcement Learning (RL) DUELING_HEAD = 'DuelingHead', PPO_HEAD = 'PPOHead', SAC_HEAD = 'SACHead', // Advanced / Niche / Future CAPSULE = 'CapsuleLayer', HYPER_NET = 'HyperNetwork', MAMBA_BLOCK = 'MambaBlock', // SSM RWKV_BLOCK = 'RWKVBlock', // RNN-Transformer Hybrid HOPFIELD = 'HopfieldLayer', // Energy Based NORMALIZING_FLOW = 'NormalizingFlow', // Probabilistic DNC_MEMORY = 'DNCMemory', // Memory Augmented ARCFACE = 'ArcFace', // Metric Learning ECHO_STATE = 'EchoStateNetwork', // Reservoir CONCAT = 'Concat', ADD = 'Add', SUBTRACT = 'Subtract', // New MULTIPLY = 'Multiply', // New AVERAGE = 'Average', // New MAXIMUM = 'Maximum', // New MINIMUM = 'Minimum', // New DOT = 'Dot', // New OUTPUT = 'Output', CUSTOM = 'CustomLayer', LAMBDA = 'Lambda', // New IDENTITY = 'Identity' } export interface LayerParameter { name: string; type: 'number' | 'string' | 'select' | 'boolean' | 'text'; label: string; default: any; options?: string[]; // For select types description?: string; } export interface LayerDefinition { type: LayerType; label: string; description: string; category: 'Core' | 'Convolution' | 'Preprocessing' | 'Recurrent' | 'Normalization' | 'Transformer' | 'GenAI' | 'Utility' | 'Merge' | 'Detection' | 'Audio' | '3D' | 'OCR' | 'Robotics' | 'Video' | 'Graph' | 'Physics' | 'Spiking' | 'RL' | 'Advanced'; parameters: LayerParameter[]; } export interface NodeData { label: string; type: LayerType; params: Record; isValid?: boolean; error?: string; onDelete?: (id: string) => void; } export interface GraphTemplate { id: string; name: string; description: string; nodes: any[]; edges: any[]; } export interface GeneratedCodeResponse { code: string; explanation: string; } export interface LogEntry { id: string; timestamp: Date; message: string; type: 'info' | 'success' | 'warning' | 'error'; }