Download code/bugfind/baselines/bank/tract_len.json from viai957/align: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/viai957/align/resolve/main/code/bugfind/baselines/bank/tract_len.json
- Command line
-
hf download hf://viai957/align/code/bugfind/baselines/bank/tract_len.json
-
curl -L -o tract_len.json https://huggingface.co/viai957/align/resolve/main/code/bugfind/baselines/bank/tract_len.json
1.8 kB
| {"item_id": "ker-tract_len", "crate_dir": "../../bench/kernels/tract_len/pre", "lib_name": "k_tract_len_pre", "provenance": {"author": "claude-sonnet subagent, blind", "written_from": "signature + doc string only", "saw_source": false, "saw_diff": false, "saw_advisory": false}, | |
| "properties": [ | |
| {"id": "p1", "fn": "tensor_len_ok", "args": [["dims", "usizes"], ["bits_per_item", "usize"], ["data_size_bytes", "usize"]], "pre": "bits_per_item >= 8", "post": "{ let b = (bits_per_item / 8) as u128; let p = if dims.contains(&0) { Some(0u128) } else { dims.iter().try_fold(1u128, |a, &d| a.checked_mul(d as u128)) }; match p { Some(p) => match p.checked_mul(b) { Some(t) => r == (t == data_size_bytes as u128), None => !r }, None => !r } }", "ret": "bool", "basis": "true iff prod(dims) * (bits_per_item / 8) == data_size_bytes in exact arithmetic"}, | |
| {"id": "p2", "fn": "tensor_len_ok", "args": [["dims", "usizes"], ["bits_per_item", "usize"], ["data_size_bytes", "usize"]], "pre": "true", "post": "!dims.is_empty() || r == (data_size_bytes == bits_per_item / 8)", "ret": "bool", "basis": "empty dims have product 1, so size must equal bits_per_item / 8"}, | |
| {"id": "p3", "fn": "tensor_len_ok", "args": [["dims", "usizes"], ["bits_per_item", "usize"], ["data_size_bytes", "usize"]], "pre": "true", "post": "!dims.contains(&0) || r == (data_size_bytes == 0)", "ret": "bool", "basis": "a zero dimension gives product 0 (fits usize), so true iff data_size_bytes == 0"}, | |
| {"id": "p4", "fn": "tensor_len_ok", "args": [["dims", "usizes"], ["bits_per_item", "usize"], ["data_size_bytes", "usize"]], "pre": "true", "post": "{ let p = dims.iter().try_fold(1usize, |a, &d| a.checked_mul(d)); !(p.is_none() && !dims.contains(&0)) || !r }", "ret": "bool", "basis": "false if the product does not fit usize"} | |
| ]} | |