/* works in one direction, if both direction is needed, we need to use
@starting-style for second direction, @see: https://www.youtube.com/shorts/xVt8Foa2u7I (Kevin Powell)
/* toggle - two 2 , starting-style needed */
/* https://jsbin.com/sokazavera/edit?html,css,output */
.txt {
background-color: #eee;
padding: 20px;
margin-top: 15px;
border-radius: 4px;
border: 1px solid #ccc;
display: none;
opacity: 0;
transition-property: all;
transition-duration: 1s;
transition-behavior: allow
/**
* Validates a partially filled 9x9 Sudoku board.
* Only filled cells are checked for rule violations.
*
* @param {character[][]} board - 2D array representing the Sudoku board
* @return {boolean} - true if the board is valid, false otherwise
*/
var isValidSudoku = function(board) {
// Set to track seen digits in rows, columns, and sub-boxes
const seen = new Set();
// Iterate over each cell in the 9x9 grid
for (let row = 0; row < 9; row++) {
for (let col = 0; co
```python
# model.py
# Minimal, self-contained PyTorch implementation of a MIDE+FORTA-style model.
# Focus: clean structure and reasonable defaults, easy to extend for research.
from typing import Dict, Optional, Tuple
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
# ----------------------------
# Small building blocks
# ----------------------------
class ConvBNAct(nn.Module):
"""Conv -> BatchNorm -> GELU"""
def __init__(self, in_ch
```python
from dataclasses import dataclass
from typing import Optional, Literal
import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
# -----------------------------
# Configuration
# -----------------------------
@dataclass
class HACSIConfig:
# Input feature dims [B, T, D]
d_vision: int
d_text: int
d_physio: int
# Shared model dim after projection
d_model: int = 512
# Fusion strategy: 'cross_att
```python
import torch
import torch.nn as nn
import torch.optim as optim
class OncoMindNetwork(nn.Module):
def __init__(self, input_dim, latent_dim, num_modalities):
super(OncoMindNetwork, self).__init__()
# Define the components for your OncoMind Network
self.transformer_branch = nn.TransformerEncoderLayer(d_model=latent_dim, nhead=8)
self.conv_branch = nn.Conv2d(input_dim, latent_dim, kernel_size=3, stride=1)
self.fc1 = nn.Linear(latent
```python
from __future__ import annotations
from typing import Optional, Dict, Any, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
class GRUContextEncoder(nn.Module):
"""
Contextual Encoding + Temporal Propagation
- Encodes E_t (environmental inputs) with a GRU to produce hidden states h_t.
Mirrors Eqs. (6)–(10) in a compact, standard GRU form.
"""
def __init__(self, env_dim: int, hidden_dim: int, num_layers: int = 1, bidir:
```python
"""
RiskSqueezeNet (minimal PyTorch reference)
------------------------------------------
A compact model for clinical risk forecasting on temporal EHR features.
Core blocks:
- Bidirectional GRU stack (hierarchical temporal encoding)
- Squeeze-and-Excitation (SE) channel gating
- Multi-Head Self-Attention for global temporal context
- Horizon-aware decoding: per-horizon classification heads (1..H)
- Optional contrastive projection head (for representation learning)
I
---
# model.py
```python
import math
from typing import Optional, Dict
import torch
import torch.nn as nn
import torch.nn.functional as F
class TemporalGating(nn.Module):
"""
Exponential decay gating: gamma_t = exp(-rho * delta_t)
Multiplies feature embeddings elementwise (Eq. 7–8).
"""
def __init__(self, d_model: int):
super().__init__()
# One learnable decay per channel (broadcasted across time)
self.rho = nn.Parameter(torch
"""
model.py — A small, configurable PyTorch model scaffold.
Usage:
from model import Model
cfg = {"task": "classification", "backbone": "conv", "in_channels": 3, "num_classes": 10}
model = Model.from_config(cfg)
y = model(x)
Design goals:
- Minimal deps (just PyTorch)
- Config-driven
- Two backbones (MLP/Conv) + two heads (classification/regression)
- Small but production-friendly utilities
"""
from typing import Dict, Any, Optional, Tuple
import math
import
---
# model.py
```python
import math
from typing import Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
class PositionalEncoding(nn.Module):
"""
Standard sinusoidal positional encoding.
"""
def __init__(self, d_model: int, max_len: int = 10000):
super().__init__()
pe = torch.zeros(max_len, d_model)
position = torch.arange(0, max_len, dtype=torch.float32).unsqueeze(1)
div_term = torch.ex
---
# model.py
```python
from typing import Tuple, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
class GraphAttentionLayer(nn.Module):
"""
A simple single-head graph attention layer over a set of latent nodes.
Given node features Z in R^{B x N x D}, it computes attention weights
alpha_{ij} = softmax_i( (Z_i W_q) · (Z_j W_k) / sqrt(Da) ) and produces
H_i = sigma( sum_j alpha_{ij} (Z_j W_v) ).
function scrollEffect() {
var $target = $('.js-target');
if(!$target.length) return;
var opt = {
root: null,
rootMargin: '0px 0px -20% 0px',
threshold: 0,
};
var observer = new IntersectionObserver(function(entries) {
$.each(entries, function(__, entry) {
if(entry.isIntersecting) {
$(entry.target).addClass('act');
observer.unobserve(entry.target);
}
// else {
//
/**
* @param {number} n
* @param {number} m
* @return {number}
*/
var flowerGame = function(n, m) {
// Count how many odd numbers are in [1, n]
const oddX = Math.floor(n / 2) + (n % 2); // e.g., 1, 3, 5...
const evenX = Math.floor(n / 2); // e.g., 2, 4, 6...
// count how many odd numbers are in [1, m]
const oddY = Math.floor(m / 2) + (m % 2);
const evenY = Math.floor(m / 2);
// Valid pairs are:
// - odd x with even y
// - even x with odd y
async function populaValoresDashBoardAdmin() {
const inputDashValoresPagos = document.getElementById('dashValoresPagos');
const waitPopup = apex.widget.waitPopup();
try {
const data = await new Promise((resolve, reject) => {
apex.server.process(
"SET_TOTAIS_DASHBOARD",
{
x01: $v('P1_DASH_INICIAL'),
x02: $v('P1_DASH_FINAL'),
x03: $v('P1_DASH_TIPO_SERVICO'),
<form method="post" action="inquiry.php" id="js_validation_form">
<input type=hidden name="action" value="">
<table class="base_table">
<tr>
<th>会社名・お名前<span class="must">必須</span></th>
<td><input name="name" type="text"></td>
</tr>
<tr>
<th>メールアドレス<span class="must">必須</span></th>
<td><input name="mailad" type="email"></td>
</tr>
<tr>
<th>電話番号<span class="must">必須</span></th>
<td><input name="tel" type="tel"></td>
</t
/**
* @param {number[][]} grid
* @return {number[][]}
*/
var sortMatrix = function(grid) {
const n = grid.length;
// Helper to extract a matrix starting at (row, col)
function getMatrix(row, col) {
const matrix = [];
while (row < n && col < n) {
matrix.push(grid[row][col]);
row++;
col++;
}
return matrix;
}
// Helper to write a sorted matrix back into the grid
function setMatrix(row, col, sorted) {