# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 2
#     language: python
#     name: python2
# ---



# +
# %matplotlib inline

import numpy as np
import pylab as plt


# +
def predict(x):
    return x+1

xsm = np.zeros((1,1000,1000,1))

# +
pad=10
lx=200
ly=200

def slider(x,predict,lx=200,ly=200,pad=20):
    prm = np.zeros(x.shape)
    li = xsm.shape[1]
    lj = xsm.shape[2]
    for i in np.arange(0,li,lx-2*pad):
        if i+lx<li:
            iii = i
            iei = i+lx
        else:
            iii = li-lx
            iei = li

        for j in np.arange(0,lj,ly-2*pad):
            if j+ly<lj:
                jii = j
                jei = j+ly
            else:
                jii = lj-ly
                jei = lj

            conx = predict(x[:,iii:iei,jii:jei,:])
            prm[:,iii+pad:iei-pad,jii+pad:jei-pad,:] = conx[:,pad:-pad,pad:-pad,:]
    return prm


# -

plt.imshow(prm)

xsm.shape


# +
def add(x,y,z,d):
    return x+y+z+d

add(23,*xsm.shape[1:])
# -

import tensorflow as tf

tf.placeholder(tf.float32,shape=[10]+list(xsm.shape[1:]))

xsm.shape[1:]



StarcoderdataJupyterScriptsDedupFiltered