mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-02-18 18:35:12 -05:00
made seed None by default -> numpy picks a random seed (#946)
* made seed None by default -> numpy picks a random seed * fixed _seed type * set the seed to unix timestamp * make filetype int only
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# inspired by https://github.com/karpathy/micrograd/blob/master/micrograd/engine.py
|
||||
from __future__ import annotations
|
||||
import math, functools, itertools, operator
|
||||
import math, functools, itertools, operator, time
|
||||
import numpy as np
|
||||
from typing import List, Tuple, Callable, Optional, ClassVar, Type, Union, Sequence
|
||||
from tinygrad.helpers import prod, argfix, make_pair, getenv, IMAGE, DEBUG, flatten, DType, dtypes, ImageDType
|
||||
@@ -122,7 +122,7 @@ class Tensor:
|
||||
@staticmethod
|
||||
def empty(*shape, **kwargs): return Tensor._loadop(LoadOps.EMPTY, prod(shape), **kwargs).reshape(shape)
|
||||
|
||||
_seed: int = 1337
|
||||
_seed: int = int(time.time())
|
||||
@staticmethod
|
||||
def manual_seed(seed=None): Tensor._seed = seed
|
||||
|
||||
@@ -606,4 +606,4 @@ for device in Device._buffers:
|
||||
from tinygrad.nn.image import image_conv2d, image_dot
|
||||
if IMAGE:
|
||||
setattr(Tensor, "conv2d", image_conv2d)
|
||||
setattr(Tensor, "dot", image_dot)
|
||||
setattr(Tensor, "dot", image_dot)
|
||||
|
||||
Reference in New Issue
Block a user