callable函数 stride的意义 Math.round(),Math.ceil(),Math.floor()用法

时间:2023-03-09 02:13:22
callable函数 stride的意义  Math.round(),Math.ceil(),Math.floor()用法

callable()函数检查一个函数是否可以调用

如果返回True,object仍然可能调用失败;但如果返回False,调用对象ojbect绝对不会成功。

对于函数, 方法, lambda 函式, 类, 以及实现了 __call__ 方法的类实例, 它都返回 True。

callable(object)
stride
卷积中的步幅是另一个构建卷积神经网络的基本操作
将蓝色框移动两个步长,你将会得到83的结果。当你移动到下一行的时候,你也是使用步长2而不是步长1,所以我们将蓝色框移动到这里:
callable函数 stride的意义  Math.round(),Math.ceil(),Math.floor()用法

1.Math.round():根据“round”的字面意思“附近、周围”,可以猜测该函数是求一个附近的整数,看下面几个例子就明白。

小数点后第一位<5
正数:Math.round(11.46)=11
负数:Math.round(-11.46)=-11
小数点后第一位>5
正数:Math.round(11.68)=12
负数:Math.round(-11.68)=-12
小数点后第一位=5
正数:Math.round(11.5)=12
负数:Math.round(-11.5)=-11
总结:(小数点后第一位)大于五全部加,等于五正数加,小于五全不加。
2.Math.ceil():根据“ceil”的字面意思“天花板”去理解;
例如:
Math.ceil(11.46)=Math.ceil(11.68)=Math.ceil(11.5)=12
Math.ceil(-11.46)=Math.ceil(-11.68)=Math.ceil(-11.5)=-11
3.Math.floor():根据“floor”的字面意思“地板”去理解;
例如:
Math.ceil(11.46)=Math.ceil(11.68)=Math.ceil(11.5)=11
Math.ceil(-11.46)=Math.ceil(-11.68)=Math.ceil(-11.5)=-12
参考:https://www.cnblogs.com/johnsonwei/p/6101171.html