common.go 474 字节
Newer Older
L
LKKlein 已提交
1 2 3
package paddle

// #cgo CFLAGS: -I../paddle_c/paddle/include
L
LKKlein 已提交
4
// #cgo LDFLAGS: -lpaddle_fluid_c
L
LKKlein 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
// #include <stdbool.h>
import "C"
import "fmt"

func ConvertCBooleanToGo(b C.bool) bool {
	var c_false C.bool
	if b != c_false {
		return true
	}
	return false
}

func numel(shape []int32) int32 {
	n := int32(1)
	for _, d := range shape {
		n *= d
	}
	return n
}

func bug(format string, args ...interface{}) error {
	return fmt.Errorf("Bug %v", fmt.Sprintf(format, args...))
}