From c9ad1f301e9d611f8615e38e3aa5ec71560a70f9 Mon Sep 17 00:00:00 2001 From: Chris Petersen Date: Thu, 14 Mar 2024 15:35:14 -0700 Subject: [PATCH] Adding the [] accessor --- ext/candle/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/candle/src/lib.rs b/ext/candle/src/lib.rs index 57f7b5d..33c5a5b 100644 --- a/ext/candle/src/lib.rs +++ b/ext/candle/src/lib.rs @@ -46,6 +46,7 @@ fn init(ruby: &Ruby) -> RbResult<()> { rb_tensor.define_method("squeeze", method!(RbTensor::squeeze, 1))?; rb_tensor.define_method("unsqueeze", method!(RbTensor::unsqueeze, 1))?; rb_tensor.define_method("get", method!(RbTensor::get, 1))?; + rb_tensor.define_method("[]", method!(RbTensor::get, 1))?; rb_tensor.define_method("transpose", method!(RbTensor::transpose, 2))?; rb_tensor.define_method("narrow", method!(RbTensor::narrow, 3))?; rb_tensor.define_method("argmax_keepdim", method!(RbTensor::argmax_keepdim, 1))?;