Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8965b09a
提交
8965b09a
authored
3月 16, 2015
作者:
Amjad Almahairi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
initial
上级
5a656e9b
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
33 行增加
和
0 行删除
+33
-0
extra_ops.py
theano/tensor/extra_ops.py
+33
-0
没有找到文件。
theano/tensor/extra_ops.py
浏览文件 @
8965b09a
...
@@ -453,6 +453,39 @@ def bincount(x, weights=None, minlength=None):
...
@@ -453,6 +453,39 @@ def bincount(x, weights=None, minlength=None):
return
BinCountOp
(
minlength
=
minlength
)(
x
,
weights
)
return
BinCountOp
(
minlength
=
minlength
)(
x
,
weights
)
def
newbincount
(
x
,
weights
=
None
,
minlength
=
None
):
"""Count number of occurrences of each value in array of non-negative ints.
The number of bins (of size 1) is one larger than the largest
value in x. If minlength is specified, there will be at least
this number of bins in the output array (though it will be longer
if necessary, depending on the contents of x). Each bin gives the
number of occurrences of its index value in x. If weights is
specified the input array is weighted by it, i.e. if a value n
is found at position i, out[n] += weight[i] instead of out[n] += 1.
Wraping of numpy.bincount
:param x: 1 dimension, nonnegative ints
:param weights: array of the same shape as x with corresponding weights.
Optional.
:param minlength: A minimum number of bins for the output array.
Optional.
.. versionadded:: 0.6
"""
# do checks ...
# general case...
max_value
=
x
.
max
()
+
1
out_dtype
=
x
.
dtype
out
=
theano
.
tensor
.
zeros
(
max_value
,
dtype
=
out_dtype
)
out
=
theano
.
tensor
.
inc_subtensor
(
out
[
x
],
1
)
return
out
def
squeeze
(
x
):
def
squeeze
(
x
):
"""Remove broadcastable dimensions from
"""Remove broadcastable dimensions from
the shape of an array.
the shape of an array.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论