Skip to content

Commit

Permalink
Update deps and fix a crash related to 0 strides.
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliu committed Oct 25, 2024
1 parent 333d0bd commit ed19320
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

git_repository(
name = "ccv",
commit = "20d998dc3c7008060df6fdfa17e932c9dae93d31",
commit = "34d496a45f2a1ba0525349b3eae8c55c7f7ac214",
remote = "https://github.com/liuliu/ccv.git",
shallow_since = "1729535387 -0400",
shallow_since = "1729877203 -0400",
)

load("@ccv//config:ccv.bzl", "ccv_deps", "ccv_setting")
Expand Down
4 changes: 2 additions & 2 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def s4nnc_deps():
git_repository,
name = "ccv",
remote = "https://github.com/liuliu/ccv.git",
commit = "20d998dc3c7008060df6fdfa17e932c9dae93d31",
shallow_since = "1729535387 -0400",
commit = "34d496a45f2a1ba0525349b3eae8c55c7f7ac214",
shallow_since = "1729877203 -0400",
)

_maybe(
Expand Down
12 changes: 7 additions & 5 deletions nnc/DynamicGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,13 @@ extension DynamicGraph.AnyTensor {
if isAlias && (shape.count != self.shape.count || (strides != nil && strides != self.strides)) {
// Check if strides not permuted. If it is permuted (and we shape to different sizes or have different strides), we need to first make a copy and then reshape again.
let oldStrides = TensorShape(dims: oldStrides)
for i in 1..<oldStrides.count {
// Otherwise we cannot reshape, need to first make a copy and then reshape.
precondition(
oldStrides[i - 1] >= oldStrides[i],
"The tensor is permuted, cannot reshape to \(shape), try .copied() before reshape.")
if oldStrides.count > 0 {
for i in 1..<oldStrides.count {
// Otherwise we cannot reshape, need to first make a copy and then reshape.
precondition(
oldStrides[i - 1] >= oldStrides[i],
"The tensor is permuted, cannot reshape to \(shape), try .copied() before reshape.")
}
}
}
let _alias = withUnsafePointer(to: &cOffset) { offset -> ccv_nnc_tensor_variable_t in
Expand Down

0 comments on commit ed19320

Please sign in to comment.