mirror of
https://github.com/huggingface/candle.git
synced 2025-06-19 03:54:56 +00:00
Use broadcasted scalars for const tensors.
This commit is contained in:
@ -99,7 +99,7 @@ impl Tensor {
|
||||
pub fn backward(&self) -> Result<GradStore> {
|
||||
let sorted_nodes = self.sorted_nodes();
|
||||
let mut grads = GradStore::new();
|
||||
grads.insert(self, self.ones_like()?);
|
||||
grads.insert(self, self.ones_like()?.contiguous()?);
|
||||
for node in sorted_nodes.iter() {
|
||||
if node.is_variable() {
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user