[go: nahoru, domu]

Skip to content

Commit

Permalink
fix bug was not initializing s->repr to NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
karpathy committed Jul 27, 2024
1 parent 2ce2e39 commit fdd88cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ CC = gcc
CFLAGS = -Wall -O3
LDFLAGS = -lm

# turn on all the warnings
# https://github.com/mcinglis/c-style
CFLAGS += -Wall -Wextra -Wpedantic \
-Wformat=2 -Wno-unused-parameter -Wshadow \
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition \
-Wredundant-decls -Wnested-externs -Wmissing-include-dirs

# Main targets
all: tensor1d libtensor1d.so

Expand All @@ -21,4 +28,4 @@ clean:
test:
pytest

.PHONY: all clean test
.PHONY: all clean test tensor1d
1 change: 1 addition & 0 deletions tensor1d.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ Tensor* tensor_slice(Tensor* t, int start, int end, int step) {
s->size = ceil_div(end - start, step);
s->offset = t->offset + start * t->stride;
s->stride = t->stride * step;
s->repr = NULL;
storage_incref(s->storage); // increment the reference count
return s;
}
Expand Down

0 comments on commit fdd88cd

Please sign in to comment.