如何在所有四个边上用0填充2D numpy数组。
a = np.array([(1, 2, 3),(4, 5, 6)])
答案 0 :(得分:0)
如上所述,您可以使用numpy.pad
。
您可以使用import net.minecraft.init.Blocks;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import org.apache.logging.log4j.Logger;
@Mod(modid = Main.MODID, name = Main.NAME, version = Main.VERSION)
public class Main
{
public static final String MODID = "immersivesignals";
public static final String NAME = "Immersive Signals";
public static final String VERSION = "1.0";
@SidedProxy(clientSide = "com.elitedire4k.immersivesignals.ClientProxy", serverSide = "com.elitedire4k.immersivesignals.CommonProxy")
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
GameRegistry.registerItem(BufferItem.instance);
GameRegistry.registerBlock(BufferBlock.instance);
proxy.preInit();
}
@EventHandler
public void init(FMLInitializationEvent event)
{
proxy.preInit();
}
}
和pad_width=1
。您可以添加mode='constant'
,但由于constant_values=0
是默认值,因此不需要这样做。
0