Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.execute(repeat=self.warmup, unbind=False)
# we want at least this many blocks
block_slots = _get_sm_count()
# loops for given size of N
loopsN = max(self.params[0] // 4, 1)
# don't bother with internal mode for N>4
modes = (0,1) if self.params[0] <= 4 else (1,)
gys = float(self.GYS)
gxs = float(self.GYS)
small_set = gys * gxs <= 512
# TODO: this needs more pruning, it takes too long for large HW
results = []
sys.stdout.write("Autotune " + native_str(self))
progress = 0
for threshold in (True, False):
for external in modes:
for strideY in range(1, self.GYS + 1):
for strideX in range(1, self.GXS + 1):
if progress % 32 == 0:
sys.stdout.write('.')
sys.stdout.flush()
progress += 1
# CRSK copies in determ mode
outputs = strideY * strideX
# minimal occupancy filter
blocks = self.blocksCK * strideY * strideX
# gemm loop size filter
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
__author__ = 'nharada'
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from builtins import * # NOQA
from future import standard_library
standard_library.install_aliases() # NOQA
import unittest
from chainer import testing
from chainer.testing import condition
import gym
import gym.spaces
import chainerrl
class ActionRecordingEnv(gym.Env):
observation_space = gym.spaces.Box(low=-1, high=1, shape=(1,))
action_space = gym.spaces.Discrete(3)
#!/usr/bin/env python
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import *
import os
import sys
import types
import shutil
#---- test constants
TMPDIR = "tmp"
#---- Support routines
def _escapeArg(arg):
def test_rev_slice_range(self):
r = range(-8, 8)
self.assertRangesEqual(r[::-1], range(7, -9, -1))
self.assertRangesEqual(r[:2:-1], range(7, -6, -1))
self.assertRangesEqual(r[:-2:-1], range(7, 6, -1))
self.assertRangesEqual(r[2::-1], range(-6, -9, -1))
self.assertRangesEqual(r[-2::-1], range(6, -9, -1))
self.assertRangesEqual(r[-2:2:-1], range(6, -6, -1))
def test_stepped_slice_range(self):
r = range(-8, 8)
self.assertRangesEqual(r[::2], range(-8, 8, 2))
self.assertRangesEqual(r[:2:2], range(-8, -6, 2))
self.assertRangesEqual(r[:-2:2], range(-8, 6, 2))
self.assertRangesEqual(r[2::2], range(-6, 8, 2))
self.assertRangesEqual(r[-2::2], range(6, 8, 2))
self.assertRangesEqual(r[2:-2:2], range(-6, 6, 2))
def test_slice_range(self):
r = range(-8, 8)
self.assertRangesEqual(r[:], range(-8, 8))
self.assertRangesEqual(r[:2], range(-8, -6))
self.assertRangesEqual(r[:-2], range(-8, 6))
self.assertRangesEqual(r[2:], range(-6, 8))
self.assertRangesEqual(r[-2:], range(6, 8))
self.assertRangesEqual(r[2:-2], range(-6, 6))
def test_stepped_slice_rev_range(self):
r = range(8, -8, -1)
self.assertRangesEqual(r[::2], range(8, -8, -2))
self.assertRangesEqual(r[:2:2], range(8, 6, -2))
self.assertRangesEqual(r[:-2:2], range(8, -6, -2))
self.assertRangesEqual(r[2::2], range(6, -8, -2))
self.assertRangesEqual(r[-2::2], range(-6, -8, -2))
self.assertRangesEqual(r[2:-2:2], range(6, -6, -2))
def test_with_metaclass_and_object(self):
"""
Issue #91
"""
from future.utils import with_metaclass
class MetaClass(type):
pass
class TestClass(with_metaclass(MetaClass, object)):
pass
Attempts to interpret all HTTP POST requests as XML-RPC calls,
which are forwarded to the server's _dispatch method for handling.
"""
# Check that the path is legal
if not self.is_rpc_path_valid():
self.report_404()
return
try:
# Get arguments by reading body of request.
# We read this in chunks to avoid straining
# socket.read(); around the 10 or 15Mb mark, some platforms
# begin to have problems (bug #792570).
max_chunk_size = 10*1024*1024
size_remaining = int(self.headers["content-length"])
L = []
while size_remaining:
chunk_size = min(size_remaining, max_chunk_size)
chunk = self.rfile.read(chunk_size)
if not chunk:
break
L.append(chunk)
size_remaining -= len(L[-1])
data = b''.join(L)
data = self.decode_request_content(data)
if data is None:
return #response has been sent
# In previous versions of SimpleXMLRPCServer, _dispatch
# could be overridden in this class, instead of in