# pytorch
# 大写的是一个用法,只有tensor不同
torch.Tensor(2, 4) # create a float32 [2, 4] shape Tensor
torch.Tensor([2, 4]) # create a float32 [2] shape Tensor
torch.tensor(2) # a int64 number of shape []
torch.tensor([1, 2, 3, 4]) # create a int64 [4] shape Tensor
torch.LongTensor(2, 4) # int64 shape: [2, 3]
torch.LongTensor([2, 4]) # int64 shape: [2]
# other type
torch.IntTensor # int32
torch.ShortTensor # int16
torch.ByteTensor # unsigned int8
torch.CharTensor # int8
torch.DoubleTensor # float64
torch.FloatTensor # float32 default Tensor
torch.HalfTensor # float16
torch.BoolTensor # bool True if value != 0
# tensorflow2
tf.constant(value=[], shape=(), dtype=type)
# type includes tf.int8/16/32/64 tf.float16/32/64
# shape can reshape value
# range
torch.arange(2, 10, dtype=torch.int16)
tf.range(2, 10, dtype=tf.int32)