max

PyTorch torch.max over multiple dimensions

不羁的心 提交于 2020-08-27 05:26:21
问题 Have tensor like : x.shape = [3, 2, 2] . import torch x = torch.tensor([ [[-0.3000, -0.2926],[-0.2705, -0.2632]], [[-0.1821, -0.1747],[-0.1526, -0.1453]], [[-0.0642, -0.0568],[-0.0347, -0.0274]] ]) I need to take .max() over the 2nd and 3rd dimensions. I expect some like this [-0.2632, -0.1453, -0.0274] as output. I tried to use: x.max(dim=(1,2)) , but this causes an error. 回答1: As of today, there is no way to do .min() or .max() over multiple dimensions in PyTorch. There is an open issue

PyTorch torch.max over multiple dimensions

眉间皱痕 提交于 2020-08-27 05:25:02
问题 Have tensor like : x.shape = [3, 2, 2] . import torch x = torch.tensor([ [[-0.3000, -0.2926],[-0.2705, -0.2632]], [[-0.1821, -0.1747],[-0.1526, -0.1453]], [[-0.0642, -0.0568],[-0.0347, -0.0274]] ]) I need to take .max() over the 2nd and 3rd dimensions. I expect some like this [-0.2632, -0.1453, -0.0274] as output. I tried to use: x.max(dim=(1,2)) , but this causes an error. 回答1: As of today, there is no way to do .min() or .max() over multiple dimensions in PyTorch. There is an open issue

How to use MAX() on a subquery result?

放肆的年华 提交于 2020-08-21 08:58:54
问题 I am new to Oracle and the SQL world. I have a slight issue with a query that I cannot figure out for the life of me, I have spent a few hours trying different approaches and I cannot get the result I expect. So heres my query: SELECT * from(Select membership.mem_desc,membership.mem_max_rentals,membership_history.mem_type, count(membership_history.MEM_TYPE) as membership_count from membership_history JOIN membership ON membership.mem_type = membership_history.mem_type group by (membership

Python: max(a list of numbers as characters) gives right and wrong answer [duplicate]

故事扮演 提交于 2020-08-10 01:12:10
问题 This question already has answers here : Python: sorting string numbers not lexicographically (5 answers) Closed 9 days ago . So here's the exact scenario- consider the list: x=['4', '5', '29', '54', '4', '0', '-214', '542', '-64', '1', '-3', '6', '-6'] now max(x) should give '542' instead it gives '6' , but if you take out '6' it does give '542' as max. min(x) on the other hand correctly gives '-214' as the answer. if you convert x into a list of numbers then obviously max(x) gives the