Skip to content

Commit

Permalink
Fix presets for PyTorch failing to link with LibTorch on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
saudet committed Dec 23, 2021
1 parent c96f0a3 commit 20f9e68
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 1 addition & 3 deletions pytorch/cppbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,7 @@ sedinplace "s/BUILD_DIR = 'build'/BUILD_DIR = os.environ['BUILD_DIR'] if 'BUILD_
sedinplace "s/var.startswith(('BUILD_', 'USE_', 'CMAKE_'))/var.startswith(('BUILD_', 'USE_', 'CMAKE_', 'CUDA_'))/g" tools/setup_helpers/cmake.py

# allow resizing std::vector<at::indexing::TensorIndex>
sedinplace '/TensorIndex(c10::nullopt_t)/i\
TensorIndex() : TensorIndex(c10::nullopt) {}\
' aten/src/ATen/TensorIndexing.h
sedinplace 's/TensorIndex(c10::nullopt_t)/TensorIndex(c10::nullopt_t none = None)/g' aten/src/ATen/TensorIndexing.h

# add missing declarations
sedinplace '/^};/a\
Expand Down
5 changes: 2 additions & 3 deletions pytorch/src/gen/java/org/bytedeco/pytorch/TensorIndex.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@ public class TensorIndex extends Pointer {

// Case 1: `at::indexing::None`
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.UninitializedObject)
public TensorIndex(@ByVal(nullValue = "c10::nullopt_t(at::indexing::None)") @Cast("c10::nullopt_t*") Pointer none) { super((Pointer)null); allocate(none); }
private native void allocate(@ByVal(nullValue = "c10::nullopt_t(at::indexing::None)") @Cast("c10::nullopt_t*") Pointer none);
public TensorIndex() { super((Pointer)null); allocate(); }
private native void allocate();

public TensorIndex(@ByVal @Cast("c10::nullopt_t*") Pointer arg0) { super((Pointer)null); allocate(arg0); }
private native void allocate(@ByVal @Cast("c10::nullopt_t*") Pointer arg0);

// Case 2: "..." / `at::indexing::Ellipsis`
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.UninitializedObject)
public TensorIndex(@ByVal EllipsisIndexType arg0) { super((Pointer)null); allocate(arg0); }
Expand Down

0 comments on commit 20f9e68

Please sign in to comment.