package ops import ( "makarna/pkg/backend/cpu" "makarna/pkg/tensor" ) // Zeros creates a new zero-filled tensor func Zeros(shape tensor.Shape) *cpu.Tensor { return cpu.NewTensor(shape, nil) // Go zeros by default } // Ones creates a new tensor filled with 1.0 func Ones(shape tensor.Shape) *cpu.Tensor { data := make([]float32, shape.NumElements()) for i := range data { data[i] = 1.0 } return cpu.NewTensor(shape, data) } // Full creates a new tensor filled with a specific value func Full(shape tensor.Shape, value float32) *cpu.Tensor { data := make([]float32, shape.NumElements()) for i := range data { data[i] = value } return cpu.NewTensor(shape, data) } // Arange creates a 1D tensor with values [start, start+step, start+2*step, ...) func Arange(start, end, step float32) *cpu.Tensor { n := int((end - start) / step) if n <= 0 { return cpu.NewTensor(tensor.Shape{0}, nil) } data := make([]float32, n) for i := 0; i < n; i++ { data[i] = start + float32(i)*step } return cpu.NewTensor(tensor.Shape{n}, data) }