summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2023-07-13 11:11:37 +0100
committerGitHub <noreply@github.com>2023-07-13 11:11:37 +0100
commitdfabc708f29b9b9ae44ded508db6da391f0b2f0f (patch)
tree5a870d3438f89e396e6e28dedf51495013c32060
parent50b0946a2dff2a65f8319ff6d798f12b2ea2a6fb (diff)
downloadcandle-dfabc708f29b9b9ae44ded508db6da391f0b2f0f.tar.gz
candle-dfabc708f29b9b9ae44ded508db6da391f0b2f0f.tar.bz2
candle-dfabc708f29b9b9ae44ded508db6da391f0b2f0f.zip
Fix a comment. (#155)
-rw-r--r--candle-core/src/tensor.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/candle-core/src/tensor.rs b/candle-core/src/tensor.rs
index e06f1d37..b9edfedc 100644
--- a/candle-core/src/tensor.rs
+++ b/candle-core/src/tensor.rs
@@ -19,12 +19,13 @@ impl TensorId {
pub struct Tensor_ {
id: TensorId,
- // Storage uses a mutex here so inner mutability is available and borrow rules are checked
- // dynamically. The alternatives would be:
+ // As we provide inner mutability on the tensor content, the alternatives are:
// - Using a mutex, this would have the highest cost when retrieving the storage but would
// prevent errors when concurrent access takes place. Mutex would also be subject to
// deadlocks for example using the current code if the same tensor is used twice by a single
// binary op.
+ // - Using a refcell unsafe cell would have some intermediary cost, borrow checking would be
+ // verified dynamically, but the resulting tensors would not be send or sync.
// - Using an unsafe cell would have the lowest cost but undefined behavior on concurrent
// accesses.
// Ideally, we would use Arc<Storage> for tensors on which we don't plan on modifying the data