MCPcopy Create free account
hub / github.com/ml-explore/mlx / get_slice_int

Function get_slice_int

python/src/indexing.cpp:45–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43}
44
45int get_slice_int(nb::object obj, int default_val) {
46 if (!obj.is_none()) {
47 if (!is_index_scalar(obj)) {
48 throw std::invalid_argument("Slice indices must be integers or None.");
49 }
50 return safe_to_int32(obj);
51 }
52 return default_val;
53}
54
55void get_slice_params(
56 mx::ShapeElem& starts,

Callers 2

get_slice_paramsFunction · 0.85
mlx_scatter_args_ndFunction · 0.85

Calls 2

is_index_scalarFunction · 0.85
safe_to_int32Function · 0.85

Tested by

no test coverage detected